How do I convert sscanf and gets into c++ code
cout <<"Enter amount: ";
gets(line);
sscanf(line,"%ld",&amount);
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
Free the weed!! Class B to class C is not good enough!!
And the FAQ is here :- http://faq.cprogramming.com/cgi-bin/smartfaq.cgi