Tried what i mentioned? Clearing test?
Tried what i mentioned? Clearing test?
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.
try cin for a spell
Code:cin >> test;
Try using cin.ignore
Thank you very much - only you got it right.Originally posted by -KEN-
Try using cin.ignore
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!
Well, watching other people fumble around is only funny for so long
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.