Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Create an output format statement that would generate lines in the table which a

ID: 3534598 • Letter: C

Question

Create an output format statement that would generate lines in the table which appear as shown below. The Item Description Field displays a description of the item contained in the desc variable. YYYY displays an integer value from the qty variable which ranges from 1 thru 9999 and should be right justified. XXXX.XX displays a monetary value from the cost variable which ranges from 0.01 to 9999.99 and should also be right justified. Use the variables shown below in your output statements.

Item Description Field........YYYY.....$XXXX.XX

string desc; int qty; double cost;

Explanation / Answer

Not sure if this is what you want, but giving it a shot.

cout << setw(30) << left << desc << setw(4) << right << qty << setw(5) << "$" << setw(7) << fixed << setprecision(2) << cost << endl;

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote