#include #include #include #include #include #include #include using namespace std; using std::cout; using std::cin; using std::endl; using std::string; using std::to_string; int main() { // All the name strings string n1; string n2; string n3; string n4; // All the gpa floats float g1; float g2; float g3; float g4; // all the income ints int c1; int c2; int c3; int c4; // spacer for all values on table int spacer; // Ask user for first input cout << "Enter a Name: " << endl; cin >> n1; cout << "Enter a GPA: " << endl; cin >> g1; cout << "Enter an Income: " << endl; cin >> c1; // Ask user for second input cout << "Enter a Name: " << endl; cin >> n2; cout << "Enter a GPA: " << endl; cin >> g2; cout << "Enter an Income: " << endl; cin >> c2; // Ask user for third input cout << "Enter a Name: " << endl; cin >> n3; cout << "Enter a GPA: " << endl; cin >> g3; cout << "Enter an Income: " << endl; cin >> c3; // Aks user for fourth input cout << "Enter a Name: " << endl; cin >> n4; cout << "Enter a GPA: " << endl; cin >> g4; cout << "Enter an Income: " << endl; cin >> c4; // Average all the lengths of the names and use this as the spacer spacer = (n1.size() + n2.size() + n3.size() + n4.size()) / 4 + 5; // Display the headers of the table cout << left << setw(spacer) << "Name" << left << setw(spacer) << "GPA" << left << setw(spacer) << "Income" << endl; // Display the first profile cout << left << setw(spacer) << n1 << " " << left << setw(spacer) << setprecision(3) << g1 << left << setw(spacer) << c1 << endl; // Display the second profile cout << left << setw(spacer) << n2 << " " << left << setw(spacer) << setprecision(3) << g2 << left << setw(spacer) << c2 << endl; // Display the third profile cout << left << setw(spacer) << n3 << " " << left << setw(spacer) << setprecision(3) << g3 << left << setw(spacer) << c3 << endl; // Display the fourth profile cout << left << setw(spacer) << n4 << " " << left << setw(spacer) << setprecision(3) << g4 << left << setw(spacer) << c4 << endl; return 0; }