0
If i want to print out five times something, in the same line
i can use multiplication somehow, like 5* " " +"hello", or i have to type it out?
4 Réponses
+ 2
#include <iostream>
using namespace std;
int main() {
for (int i = 0; i <=5; i++) {
cout << "Hello" << endl;
}
return 0;
}
+ 1
Use a for loop
For ( int i = 0; i <= 5; i++)
{
Your code goes here
}
+ 1
int i = 0;
while( i < 5)
{
cout << "Hello World" << endl;
i++;
}
0
thanks guys!