Last active
February 1, 2017 03:55
-
-
Save amanat361/688741cb3bdc537f0814787cdbae1141 to your computer and use it in GitHub Desktop.
Some starting C++ code
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <iostream> | |
| using namespace std; | |
| int main() { | |
| int rows; | |
| do // input validation loop | |
| { | |
| cout << "Enter the number of rows (must be at least 2): "; | |
| cin >> rows; | |
| } | |
| while (rows < 2); | |
| for (int curr_row = 0; curr_row < rows; curr_row++) | |
| { | |
| for (int curr_col = 0; curr_col < curr_row; curr_col++) | |
| cout << " "; | |
| cout << "#" << endl; | |
| } | |
| return 0; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment