I began learning C++ today, and it's my first programming language so please bear with me. I want to execute a for loop that would allow me to receive the input as a string and then output it, multiple times.
1 2 3 4 5 6 7 8 9 10 11 12 13
#include <iostream>
usingnamespace std;
int main()
{
string input = "";
cout << "What is your name: \n";
for ( int x = 10; x < 20; x++ )
getline( cin, input );
cout << "Your name is " << input <<"!";
cin.get();
}
There code above is heading in the right direction. But the main problem is the missing braces { and } around the statements which are to be controlled by the loop.