thank you for reading. I am a new programmer in an introductory programming class, and I only have a month's worth of training in C++. I have tried to fix this code with many approaches, but I don't know why it only prints one word of my input string:
#include <iostream>
#include <cstdlib>
#include <string>
using namespace std;
void printThetxt(string);
string inputText(string);
int main() {
string x;
printThetxt(inputText(x));
system("pause");
return 0;
}
void printThetxt(string y) {
cout << y << endl;
}
string inputText(string x) {
cout << "Type in your string: " << endl;
cin >> x;
return x;
}
Please tell me why this code only prints one piece of the input string? Thank you!!