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
Subject:Computer SciencePrice:2.87 Bought7
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