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;
}
Printable View
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;
}