aboutsummaryrefslogtreecommitdiff
path: root/CST116-Ch5-Debugging/CST116-Ch5-Debugging.cpp
diff options
context:
space:
mode:
authorMusa Ahmed <[email protected]>2022-10-05 20:25:49 -0700
committerMusa Ahmed <[email protected]>2022-10-05 20:25:49 -0700
commitfb58a93ff2207656725e01448cb8436d249724c1 (patch)
tree1cbbddd905cc49ee2c245faedc715d7b5c93b58c /CST116-Ch5-Debugging/CST116-Ch5-Debugging.cpp
parentadded for loop (diff)
downloadcst116-proj1-fb58a93ff2207656725e01448cb8436d249724c1.tar.xz
cst116-proj1-fb58a93ff2207656725e01448cb8436d249724c1.zip
got main thingy working
Diffstat (limited to 'CST116-Ch5-Debugging/CST116-Ch5-Debugging.cpp')
-rw-r--r--CST116-Ch5-Debugging/CST116-Ch5-Debugging.cpp42
1 files changed, 16 insertions, 26 deletions
diff --git a/CST116-Ch5-Debugging/CST116-Ch5-Debugging.cpp b/CST116-Ch5-Debugging/CST116-Ch5-Debugging.cpp
index 71d06c9..8b1803b 100644
--- a/CST116-Ch5-Debugging/CST116-Ch5-Debugging.cpp
+++ b/CST116-Ch5-Debugging/CST116-Ch5-Debugging.cpp
@@ -16,44 +16,34 @@ using std::to_string;
int main()
{
- string n1;
- string n2;
- string n3;
- string n4;
-
- string g1;
- string g2;
- string g3;
- string g4;
-
- string i1;
- string i2;
- string i3;
- string i4;
-
+
vector<string> n;
vector<string> g;
vector<string> c;
+ string temp;
for (int i = 0; i < 4; i++) {
- cout << "enter a name" << endl;
- cin >> n1;
- n.push_back(n1);
+ cout << "Enter a name: " << endl;
+ cin >> temp;
+ n.push_back(temp);
- cout << "enter a gpa" << endl;
- cin >> g1;
- g.push_back(g1);
+ cout << "Enter a gpa: " << endl;
+ cin >> temp;
+ g.push_back(temp);
- cout << "enter an income" << endl;
- cin >> i1;
- c.push_back(i1);
+ cout << "Enter an income: " << endl;
+ cin >> temp;
+ c.push_back(temp);
}
- for (string i : n) {
- cout << i << ' ';
+ for (int i = 0; i < 4; i ++) {
+ cout << "Profile #" << i << ' ' <<
+ "Name: " << n[i] << ' ' <<
+ "GPA: " << g[i] << ' ' <<
+ "Income: " << c[i] << endl;
}
return 0;