aboutsummaryrefslogtreecommitdiff
path: root/CST116-Ch5-Debugging/Project1.cpp
blob: e7fc1749889df261103948e5f9dca8acb1c36c94 (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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
#include <iostream>
#include <iomanip>
#include <string>
#include <list>
#include <bitset>
#include <vector>
#include <math.h>

using namespace std;
using std::cout;
using std::cin;
using std::endl;
using std::string;
using std::to_string;

int main()
{
    string n1;
    string n2;
    string n3;
    string n4;
   

    float g1;
    float g2;
    float g3;
    float g4;
   
    
    int c1;
    int c2;
    int c3;
    int c4;
    
    int spacer;


    
    cout << "Enter a Name: " << endl;
    cin >> n1;
    cout << "Enter a GPA: " << endl;
    cin >> g1;
    cout << "Enter an Income: " << endl;
    cin >> c1;

   
    
    cout << "Enter a Name: " << endl;
    cin >> n2;
    cout << "Enter a GPA: " << endl;
    cin >> g2;
    cout << "Enter an Income: " << endl;
    cin >> c2;

   
    
    cout << "Enter a Name: " << endl;
    cin >> n3;
    cout << "Enter a GPA: " << endl;
    cin >> g3;
    cout << "Enter an Income: " << endl;
    cin >> c3;

    
    
    cout << "Enter a Name: " << endl;
    cin >> n4;
    cout << "Enter a GPA: " << endl;
    cin >> g4;
    cout << "Enter an Income: " << endl;
    cin >> c4;

    spacer = (n1.size() + n2.size() + n3.size() + n4.size()) / 4 + 5;

    cout << left << setw(spacer) << "Name"
        << left << setw(spacer) << "GPA"
        << left << setw(spacer) << "Income"
        << endl;

    cout << left << setw(spacer) << n1 << " "
        << left << setw(spacer) << g1
        << left << setw(spacer) << c1
        << endl;

    cout << left << setw(spacer) << n2 << " "
        << left << setw(spacer) << g2
        << left << setw(spacer) << c2
        << endl;

    cout << left << setw(spacer) << n3 << " "
        << left << setw(spacer) << g3
        << left << setw(spacer) << c3
        << endl;

    cout << left << setw(spacer) << n4 << " "
        << left << setw(spacer) << g4
        << left << setw(spacer) << c4
        << endl;


    return 0;
}