Respuesta :
#include <iostream>
#include <string>
using namespace std;
int main() {
string userInput;
cout << "Enter word" << endl;
cin >> userInput;
cout << "you entered" << endl;
cout << userInput;
return 0;
}
#include <string>
using namespace std;
int main() {
string userInput;
cout << "Enter word" << endl;
cin >> userInput;
cout << "you entered" << endl;
cout << userInput;
return 0;
}
Just reading and writing a string should be as easy as:
string msg;
getline(cin, msg);
cout << "Hello " << msg;
return 0;
string msg;
getline(cin, msg);
cout << "Hello " << msg;
return 0;