I have to write a program that prints * depending on the user input. The user inputs 5 integers and outputs the corresponding *'s. So 1=* 3=*** 5=*****, etc.
Here's what I got so far: Any hints or tips or can someone help me fix it? I'm not sure how to ensure the user inputs 5 times.
1 2 3 4 5 6 7 8 9 10 11 12 13
#include <iostream>
usingnamespace std;
int main()
{
int input = 0;
cout << "Enter an integer: ";
cin >> input;
for (int x=0; x< iput, x=++}
}
How can I make it continually loop? Do I need a control condition/while loop?
or
is it possible to have the user input 5 integers in the beginning and have the output show at the end?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
#include <iostream>
usingnamespace std;
int main()
{
int input = 0;
cout << "Enter an integer: ";
cin >> input;
for(int num=0; num < input; num++)
{
cout<<"*";
}
}