Tech^salvager
09-15-2004, 11:02 PM
Hi guys well I'm having a hard time figuring out what cin.get is used for can anyone here give a summary of what it does.
Thanks Tech^
Thanks Tech^
| //flex table opened by JP
Click to See Complete Forum and Search --> : cin.get Tech^salvager 09-15-2004, 11:02 PM Hi guys well I'm having a hard time figuring out what cin.get is used for can anyone here give a summary of what it does. Thanks Tech^ fishybawb 09-17-2004, 06:10 AM cin.get lets you accept x characters of input from the keyboard, stopping when it reaches the delimiter: cin.get(string, 10, '\n'); That would read in 10 characters to the string variable "string", storing the data once the enter key has been pressed. If you tried entering a sentence (with spaces) and grabbing the input with just a cin, you'd only end up with the first word. nothing 09-17-2004, 07:16 AM It can also be used to keep the console window opened after the program finishes executing. :D At times, if it doesn't work, just put a cin.sync() right before it. (Mr. fishy thought me this one ;) ) cwin 09-18-2004, 07:05 AM i just #include <conio.h> and do getch(); at the end if i want to hold the program open after its done nothing 09-18-2004, 10:12 AM Originally posted by cwin i just #include <conio.h> and do getch(); at the end if i want to hold the program open after its done That way you'd be mixing C with C++. cwin 09-18-2004, 10:40 AM Originally posted by nothing That way you'd be mixing C with C++. yes, but normally i make my own wrapper classes for conio.h :D Tech^salvager 09-18-2004, 04:23 PM no mixing C with C++ Thanks guys finally I have a better understanding on that. SysOpt.com
Copyright Internet.com Inc. All Rights Reserved. |