Question: Create a program in C++ that takes in Name, gpa, and scholarship amount from the user: Be sure to use fixed, showpoint, and setprecision to

Create a program in C++ that takes in Name, gpa, and scholarship amount from the user:

  • Be sure to use fixed, showpoint, and setprecision to your desired decimal points.
  • Print the name, gpa, and scholarship amount back to the user with default setfill and setw output settings.
  • Print the name, gpa, and scholarship amount back to the user with at least 3 different setfill and/or setw output settings in each. You can use different ones within the same line if you like.
  • Set the output settings back to default and print the name, gpa, and scholarship amount again.
  • Below is the original code

//Example: This program illustrates how the function //setfill works.

#include //Line 1 #include //Line 2 #include //Line 3 using namespace std; //Line 4

int main() //Line 5 { //Line 6 string name = "Jessica"; //Line 7 double gpa = 3.75; //Line 8 int scholarship = 7850; //Line 9

cout << "123456789012345678901234567890" << endl; //Line 10 cout << fixed << showpoint << setprecision(2); //Line 11

cout << setw(10) << name << setw(7) << gpa << setw(8) << scholarship << endl; //Line 12

cout << setfill('*'); //Line 13 cout << setw(10) << name << setw(7) << gpa << setw(8) << scholarship << endl; //Line 14

cout << setw(10) << name << setfill('#') << setw(7) << gpa << setw(8) << scholarship << endl; //Line 15

cout << setw(10) << setfill('@') << name << setw(7) << setfill('#') << gpa << setw(8) << setfill('^') << scholarship << endl; //Line 16

cout << setfill(' '); //Line 17 cout << setw(10) << name << setw(7) << gpa << setw(8) << scholarship << endl; //Line 18

return 0; //Line 19 } //Line 20

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!