#include<iostream>
#include<string>
usingnamespace std;
int main( void )
{
unsignedint howMany;
cout << "How many times would you like to say Hi?" << endl;
cin >> howMany;
for( unsignedint hiCounter = 0; hiCounter < howMany; ++hiCounter )
{
cout << "Hi" << endl;
}
return 0;
}
EDIT: I forgot the explanation.
First you declare an unsigned integer variable that you designate to be your # of times you want your message to appear. You then notify the user of the intent of the program (aka what exactly are they inputting, and for what reason?).
Then comes the for loop, which has a designated unsigned integer counting variable that will loop through once for every time the counter is less than the # of times you want.
Btw unsigned int means that the number you designate can never be negative. Same goes for size_t and a few others which I forget.