User Profile

Collapse

Profile Sidebar

Collapse
vninja
vninja
Last Activity: Nov 7 '06, 08:54 PM
Joined: Oct 9 '06
Location: Phoenix, AZ
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • vninja
    replied to Variable Filenames
    in C
    yea i do the same thing with the if an of streams
    See more | Go to post

    Leave a comment:


  • vninja
    replied to Variable Filenames
    in C
    Thx didn't know you cin would work with arrays. i'll try it out. thx again
    See more | Go to post

    Leave a comment:


  • vninja
    replied to Variable Filenames
    in C
    my problem lies within the outfile.open(fi lename)

    because of the syntax of the open() function quotes are required around the filename therefore i need to add them, otherwise if i use open("filename" ) it takes filename literally and not the var filename.

    [C++ Error] File1.cpp(12): E2034 Cannot convert 'string' to 'const char *'
    [C++ Error] File1.cpp(12): E2342 Type mismatch in parameter '__s' (wanted...
    See more | Go to post

    Leave a comment:


  • vninja
    replied to Rounding
    in C
    easiest thing to do is to use the "setprecision(N )" command and have N be a global int const for the desired ammount of decimal places that way you can chage it easier later on when code gets really big and complex n confusing
    See more | Go to post

    Leave a comment:


  • vninja
    replied to question on whitespace in string
    in C
    are you looking to get rid of the whitespace before the string or throughout?
    for case one you could just add a cin >> fistword; then after the getline st = firstword + st1;
    for the second case i'm not too sure....
    See more | Go to post

    Leave a comment:


  • vninja
    started a topic Variable Filenames
    in C

    Variable Filenames

    Hey there pretty new to C++ and i'm trying to create a file that will create a file based on user input
    here is a little snipplet of my code:


    getline(cin,/*string*/ filename,'\n');
    filename= " \" " + filename +" \" ";
    outfile.open(fi lename);


    any help appriciated thx
    See more | Go to post

  • vninja
    replied to Strings
    in C
    also you could use the getline cmd. be sure to use the cin.ignore(25, '\n') between the cin.

    with your ifstream (i believe srry really tired here), lets say infile, use the getline with the tab delimiter to get the info, followed by a cin.ignore, then infile>> to get the int. getline only works for strings so be careful;

    basic code
    getline(infile, stringVARIABLEn ame, delimiter);
    cin.ignore(intO FhowMANYcharsTO ignore,...
    See more | Go to post

    Leave a comment:


  • vninja
    replied to Creating A Chessboard Program in C++
    in C
    Here is my output (let me try again)
    ***** *****
    ***** *****
    ***** *****
    ***** *****
    ***** *****
    ***** *****
    ***** *****
    ***** *****
    ***** *****
    ***** *****
    ***** *****
    ***** *****
    looks good on my post and on my screen but don't know if posting will cause formatting er...
    See more | Go to post

    Leave a comment:


  • vninja
    replied to Creating A Chessboard Program in C++
    in C
    here is my output:

    ***** ***** ***** ***** ***** *****
    ***** ***** ***** ***** ***** *****
    ***** ***** ***** ***** ***** *****
    ***** ***** ***** ***** ***** *****
    ***** ***** ***** ***** ***** *****
    ***** ***** ***** ***** ***** *****
    ***** ***** ...
    See more | Go to post

    Leave a comment:


  • vninja
    replied to Creating A Chessboard Program in C++
    in C
    i tried approaching this challenge a different way. first off i made this program write one line of the whole board x number times then made it rpt a couple of time (pardon the poor writing but its 5 in the morning and i'm dead tired (working) trying to get things to makes sense)

    here is my program for creating the board. personally i would have used arrays and functions but this is taking off of what you had originally.
    ...
    See more | Go to post

    Leave a comment:


  • vninja
    replied to difficulty
    in C
    I couldn't help you with what the error stands for however if you submit your code i'm pretty sure that someone in this community would have an answer for you
    plus it would make it easier for us to spot what your specifically doing worng and not just give you the reason(s) why that error is appearing
    See more | Go to post

    Leave a comment:


  • vninja
    replied to i need your help
    in C
    pulling somthing out of my @$$ here but try
    #include<cmath>
    See more | Go to post

    Leave a comment:


  • vninja
    replied to need your help, i'm waiting
    in C
    returns the distance between the two points.
    Write a function “distance” that takes four arguments

    from these two parameters you know you have somthing like

    returntype functionname(ar g1, arg2, arg3, arg4)
    {
    since your finding the distance use the pythagorean therom from the difference of two of the four arguments
    return ans of formula
    }
    and i have no idea what you mean by...
    See more | Go to post

    Leave a comment:


  • vninja
    started a topic Primitive Passwords
    in C

    Primitive Passwords

    Hey!

    I got a really simple idea for creating and storing passwords i just don't know how to code it.

    to realize my idea i need to create a txt file that will store passwords i'm just confused by the fstream commands.
    how could i impliment reading a file to find a certain word?

    for example lets say i create a password "Boog". and place it after pswd2: in a file ( pswd2: Boog).
    ...
    See more | Go to post

  • vninja
    started a topic Getting A Clock to Appear
    in C

    Getting A Clock to Appear

    Hey i have no idea if this is even possible without a GUI.
    just for fun i'd like to create a timeclock program for win xp using C++ .NET. i though it'd b neat if i could see the time in the form of a clock in 24 hr on the screen. (11:25:59) hours:min:sec.
    also is there a way for me to be able to throw in a switch with a case
    "I" that would get the current time? (i.e. press i and double variable "in" gets...
    See more | Go to post

  • vninja
    replied to how to convert decimal number to binary
    in C
    uhhhh stay away from recursive programming!!!! ! yea its easy but it eats up mem and cpu usage!!!!!
    i.e.
    go to a porn site (and turn your popup blocker off!!!).
    this is what recursive programing does if each window was a recursive function call.

    pretty much each time you call a function (lets say b) the calling function (lets say a) is put on hold.
    therefor function a calls b and both are open until b closes/ends...
    See more | Go to post

    Leave a comment:


  • vninja
    replied to Homework Help!
    in C
    here is my output

    --Vote Analysis Program--
    Enter votes for Kerry: 498
    Enter votes for Bush: 356
    Enter votes for horking: 256

    Candidate : Kerry
    Votes: 498
    Percentage: 44.8649

    Candidate : Bush
    Votes: 356
    Percentage: 32.0721

    Candidate : horking
    ...
    See more | Go to post

    Leave a comment:


  • vninja
    replied to Homework Help!
    in C
    like banfa said: your not static casting the right way. (you can't div int by int and then static cast but you have to div static cast by int of int by static cast.)

    try this code:



    #include <iostream>
    #include "string.h"
    using namespace std;

    int main()
    {
    string candidate1 = "";
    string candidate2 = "";
    ...
    See more | Go to post

    Leave a comment:


  • vninja
    replied to post fix and pre fix operator simple puzzle
    in C
    it might depend on the program/compiler as well

    for the two
    the way it would be 12 and not 6 would be because it incriments and decrements the prefix before it uses the value and not the statement; ie

    a=2

    x=++a*--a*a++
    it would incriment a to 3 first
    then a =3 and not 2!!!!
    producing 3*2
    then since we postfix a is changed after use
    making the expression x=3*2*2=12...
    See more | Go to post

    Leave a comment:


  • vninja
    replied to post fix and pre fix operator simple puzzle
    in C
    it should be 5 but since its the same variable consider:

    x=++a*--a*a++;
    since your incrimenting and decrimenting it becomes the original value

    prstatement
    a=6

    first (++a)
    a=7
    secont pre(--a)
    a=6
    no more pre means do the statement
    x=6*6*6
    x=216
    post fix (a++)
    a = 7
    See more | Go to post

    Leave a comment:

No activity results to display
Show More
Working...