blob: 3a7af6e3428b8581166da4cd88309e4d838a3957 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
/*
Date: 20 Feb 2019
Name: Matthew Strapp
Student ID number: 5449340
Course number: EE1301
Term: Spring 2019
Lab/assignment number: Homework 2A
Short Program Description: Useless Counter
*/
#include <iostream>
using namespace std;
int main () {
int countOG, i, j;
do {
do {
cout << "Enter an integer from -50 to 50: ";
cin >> countOG;
} while (countOG > 50 || countOG < -50);
int count=countOG; //Store original integer for comparison to break loop
if (countOG < 0){
count*=-1;
for (i=count; i>0; i--) {
for (j=count; j>0; j--) {
cout << count;
}
count--;
cout << endl;
}
}
if (countOG > 0) {
count=1; //Sets initial printing of countOG to 1
for (i=1; i<=countOG; i++) {
for (j=0; j<count; j++) {
cout << i;
}
count++;
cout << endl;
}
}
} while (countOG != 0);
cout << "Goodbye." << endl;
return 0;
}
|