#include <iostream> #include <stdlib.h> using namespace std; int main () { //Initialization int x = 0; //number of times the loop will run string letter; //the character that will be displayed X number of times int number = 0; // Input cout << "Please input a positive integer: " ; cin >> x; cout << "Please input a character: " ; cin >> letter; //Loop while (number < x) { cout << letter << endl; number = number + 1; } return 0; } |
= == === ==== ===== |
cout << letter;
only that runs a number + 1 number of times and has its own variable to iterate.for
loops. They improve readability. ^_^for /*not*/ For
.