New to C++ looking for help!
Hey I just started picking up c++ and was trying to write some of my own stuff. One problem I have come across is with the input. when im using standard cout/cin for strings, they work fine if i dont use a space while input'n, but as soon as I do it doesn't work.
I think I'm looking for streams but am unfamiliar with the correct code for it.
To use streams what do i need in the header? Does iostream work?
what are the uses I am looking for to enjoy input with spaces and other symbols for strings????
Thx a bunch ! :D
Re: New to C++ looking for help!
You need to be using cin.getline function for string containing spaces.
Here is the signature of of the getline function.
istream& getline (char* s, streamsize n, char delim );
A pointer to an array of characters.n
The maximum number of characters to store, including the ternimating null character.delim
The delimiter. The operation of extracting succesive characters is stopped when delimiter is read. This parameter is optional, if not specified the function considers '\n' the delimiter.Return Value.
The function returns *this
|All times are GMT +5.5. The time now is 10:42.|