Ask Question

Name:
Title:
Your Question:

Answer Question

Name:
Your Answer:
User Submitted Source Code!


Description:
  su2019_lab3part2_wagle
Language: C/C++
Code:
#include <iostream>
#include <iomanip>

using namespace std;
int main(){
int P1,P2,P3,P4,P5;
float U1,U2,U3,U4,U5;
string name = " ";
cout<<"Enter your name: "<<endl;
getline(cin,name);
cout<<"Enter the number of products: "<<endl;
cin>>P1>>P2>>P3>>P4>>P5;
cout<<"Enter the unit prices of Products: "<<endl;
cin>>U1>>U2>>U3>>U4>>U5;
cout << fixed << showpoint << setprecision(2);

cout<<"---------------------------------------------------------------------------------------"<<endl;
cout<<name <<"      PRODUCT1"<< "  PRODUCT2"<<"  PRODUCT3"<<"  PRODUCT4"<<"  PRODUCT5"<<endl;

cout<<"---------------------------------------------------------------------------------------"<<endl;
cout<<"Number of items "<< setw(9)<< P1<<setw(9)<< P2<<setw(9)<<P3<<setw(9)<<P4<<setw(9)<<P5<<endl;
cout<<"Unit price      " <<setw(9)<<U1<<setw(9)<<U2<<setw(9)<<U3<<setw(9)<<U4<<setw(9)<<U5<<endl;

cout<<"---------------------------------------------------------------------------------------"<<endl;
cout<<"Money           " << setw(9)<< P1*U1<<setw(9)<<P2*U2<<setw(9)<<P3*U3<<setw(9)<<P4*U4<<setw(9)<<P5*U5<<endl;
cout<<"---------------------------------------------------------------------------------------"<<endl;
cout<<"Total money sold in a day: "<< (P1*U1)+(P2*U2)+(P3*U3)+(P4*U4)+(P5*U5)<<endl;






return 0;
}
          
Comments: