question archive C++ Give an output statement to write one line of a table containing a product description, quantity, unit price, and total price in dollars and cents

C++ Give an output statement to write one line of a table containing a product description, quantity, unit price, and total price in dollars and cents

Subject:Computer SciencePrice:2.87 Bought7

C++ Give an output statement to write one line of a table containing a product description, quantity, unit price, and total price in dollars and cents. You want the columns to line up, like this:
Item                  Qty  Price     Total
Toaster               3    $29.92    $89.85
Hair Dryer            1    $24.95    $24.95
Car Vacuum            2    $19.99    $39.98

pur-new-sol

Purchase A New Answer

Custom new solution created by our subject matter experts

GET A QUOTE

Answer Preview

Answer:

#include <iostream>

#include <iomanip>

using namespace std;

int main()

{

cout<<"Item\t\tQty\tPrice\tTotal"<<endl;

cout<<setw(10)<<left<<"Toaster"<<"\t3"<<"\t$29.92"<<"\t$89.85"<<endl;   

cout<<setw(10)<<left<<"Hair Dryer"<<"\t1"<<"\t$24.95"<<"\t$24.95"<<endl;

cout<<setw(10)<<left<<"Car Vacuum"<<"\t2"<<"\t$19.99"<<"\t$39.98"<<endl;

return 0;

}

Output:

PFA

Related Questions