C++::std::cin
hi all,
how can i specify to cin number of character to read from input? eg: input: Dec90 so i want to stock Dec in a string variable, and 90 in int variable. i think in C is something like: Code:
scanf("%3s%2d",&STRING,&INTEGER) |
Streams are designed to tokenize input. Either make sure the input read in is whitespace separated or separated by some other special char, or just use the C function and forget about streams.
|
Quote:
char date[4]; // 4 for terminating nul that get() adds. int year; cin.get(date, 3) >> year; Mike |
thank you all
|
All times are GMT -5. The time now is 01:51 AM. |