View Single Post
Old 03-10-2005, 06:16 PM   #4 (permalink)
TheFrogel
Tilted
 
Location: Pennsylvania
cin.ignore(100, '\n');
What's the 100 mean? And are you telling it to ignore newline inputs, or what does the second argument mean? I'll do a bit of research, but it's always good hearing from someone who knows it.

Clarification: After I hit the letter 'b', the Line 2 statement appears, ("Line 2, temp1=b") AND 'b' shows up on the following line at the same time. What I want to happen is for the 'b' to NOT show up on the following line. It won't show as long as I use getch() statements, but as soon as a cin>> appears, the last thing I type shows up. And yes, when I type 'b' it shows up where I have 'c' in its own line in the second section of output.

EDIT: Found stuff about cin.ignore():
std::cin.ignore() can be called three different ways:

No arguments: A single character is taken from the input buffer and discarded:
std::cin.ignore(); //discard 1 character
One argument: The number of characters specified are taken from the input buffer and discarded:
std::cin.ignore(33); //discard 33 characters
Two arguments: discard the number of characters specified, or discard characters up to and including the specified delimiter (whichever comes first):
std::cin.ignore(26, '\n'); //ignore 26 characters or to a newline, whichever comes first


off of this page , very useful. I'll try this and see what happens...but I'm going to sleep now.

Last edited by TheFrogel; 03-10-2005 at 06:25 PM..
TheFrogel is offline  
 

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62