How do I convert sscanf and gets into c++ code
cout <<"Enter amount: ";
gets(line);
sscanf(line,"%ld",&amount);
Printable View
How do I convert sscanf and gets into c++ code
cout <<"Enter amount: ";
gets(line);
sscanf(line,"%ld",&amount);
the gets() equivalent is cout.getline()
i don't think there is an equivalent for sscanf... but sscanf doesn't interfere with c++ file i/o, anyway, so you should be fine using that.
dont u mean istream.getline and not ostream.getline.
i.e. cout.getline is wrong and cin.getline is ok