hi. in C i can use gets function to create a string array but in c++
how can i do this?
for instance:
is that true?Code:#include <iostream> #include <string> main() { string *sentence; cin>>sentence; cout<<sentence; }
hi. in C i can use gets function to create a string array but in c++
how can i do this?
for instance:
is that true?Code:#include <iostream> #include <string> main() { string *sentence; cin>>sentence; cout<<sentence; }
not quite.
Code:#include <iostream> #include <string> using namespace std; // using new style headers everything is in namespace std int main() { string sentence; //u need object not pointer cin>>sentence; cout<<sentence<<endl; return 0; }
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