Input a sentence (with the getline(cin, string) command from before) and an
integer value, for the number of time the sentence will print (check for positive number
as in the recommended loop above, but no worry about characters).
Simulate an output as the following:
Enter a sentence to write on the board:
I will not chew gum in class!!!
How many times should it be written? 5
The concatenated string is now:
I will not chew gum in class!!!
I will not chew gum in class!!!
I will not chew gum in class!!!
I will not chew gum in class!!!
I will not chew gum in class!!!
this is what im suppose to code and so far i did that much but its not working
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
|
#include <iostream>
#include <string>
using namespace std;
int main()
{
int num;
string sentence;
cout<< "Enter a sentence to write on the board.\n";
getline(cin,sentence);
for (int i=0, i<=0,i++);
cout << "how many times would you like it to be written?";
cin<<num;
cout<<num<<endl;
return 0;
}
|