|
in,sin//No such thing, it should be in or sin in istream in("a.txt");
Cin//The global object of istream stored in iostream, usage:
int i;
cin>>i;
string t;
cin>>t;
getline usage
std::string s;
while (getline(std::cin,s)) {//End with '\n'
...
}
while (getline(std:: cin, s,':')) {//End with':'
...
}
In addition, istream also has a getline member function, usage:
getline(s, num) can read at most num -1 characters, ending with '\n', including '\n'
getline(s, num, t) ends with t, others are the same as above
ignore():
istream&istream::ignore ()//Skip a character
istream&istream::ignore (streamsize count)//Skip count characters
istream&istream::ignore (streamsize count, int delim)//Skip count characters or encounter delim |
|