Skip to content

Instantly share code, notes, and snippets.

@JohnPhamous
Last active April 27, 2016 21:15
Show Gist options
  • Save JohnPhamous/7ab276599fd89050eaf4b624032ea908 to your computer and use it in GitHub Desktop.
Save JohnPhamous/7ab276599fd89050eaf4b624032ea908 to your computer and use it in GitHub Desktop.
#include <iostream>
using namespace std;
int main() {
char userChar;
int userInt;
int count = 1;
cout << "Enter a character: ";
cin >> userChar;
cout << "Enter number of rows: ";
cin >> userInt;
cout << endl;
int count2 = userInt;
while(count <= userInt) {
if(count != userInt){
cout << " ";
++count;
}
if(count == count2) {
while(count <= userInt){
cout << userChar << " ";
++count;
}
cout << endl;
count = 1;
--count2;
}
if(count == userInt){
count = 1;
while(count <= userInt) {
cout << userChar << " ";
++count;
}
cout << endl;
}
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment