Flooded :(

This is a discussion on Flooded :( within the C++ Programming forums, part of the General Programming Boards category; Tried what i mentioned? Clearing test?...

  1. #16
    Registered User
    Join Date
    Sep 2002
    Posts
    1,640
    Tried what i mentioned? Clearing test?

  2. #17
    Ice_Black
    Guest
    int main()
    {
    char test[256];


    for (int i = 1; i <=4; i++)
    {
    cout <<"Please enter your name: ";
    cin.get(test,256);
    cout <<i <<") you said: " <<test <<endl;
    }

    getch();
    return 0;
    }


    It return:

    Please enter your name: Shahid
    1) you said: Shahid
    Please enter your name: 2) you said:
    Please enter your name: 3) you said:
    Please enter your name: 4) you said:



    But it didnt ask me to enter a word on 2-4 loop
    it simply ignore cin.get(test,256); on second to forth (2 to 4) loops


    I hope you understand my point.

    I am using Borland Compiler.

  3. #18
    Registered User
    Join Date
    Sep 2002
    Posts
    1,640
    try cin for a spell

    Code:
     cin >> test;

  4. #19
    Just one more wrong move. -KEN-'s Avatar
    Join Date
    Aug 2001
    Posts
    3,230
    Try using cin.ignore

  5. #20
    Ice_Black
    Guest
    Originally posted by -KEN-
    Try using cin.ignore
    Thank you very much - only you got it right.


    The output it work now:

    Please enter your name: Hello
    1) you said: Hello
    Please enter your name: Cat
    2) you said: Cat
    Please enter your name: Sex
    3) you said: Sex
    Please enter your name: IRCD
    4) you said: IRCD



    Thanks!

  6. #21
    Just one more wrong move. -KEN-'s Avatar
    Join Date
    Aug 2001
    Posts
    3,230
    Well, watching other people fumble around is only funny for so long

  7. #22
    In The Light
    Join Date
    Oct 2001
    Posts
    598
    howdy,
    -ken- is my hero.
    good job -ken-

    M.R.
    I don't like you very much. Please post a lot less.
    Cheez
    *and then*
    No, I know you were joking. My point still stands.

Page 2 of 2 FirstFirst 12
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Tales of a Flooded World - Freeware
    By Corky12190 in forum Projects and Job Recruitment
    Replies: 1
    Last Post: 06-25-2006, 12:19 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21