Skip to content

Instantly share code, notes, and snippets.

@amanat361
Last active February 1, 2017 03:55
Show Gist options
  • Select an option

  • Save amanat361/688741cb3bdc537f0814787cdbae1141 to your computer and use it in GitHub Desktop.

Select an option

Save amanat361/688741cb3bdc537f0814787cdbae1141 to your computer and use it in GitHub Desktop.
Some starting C++ code
#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