Advertisement
KeeganT

Ass66

Oct 15th, 2017
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.57 KB | None | 0 0
  1. #include <iostream>
  2. #include <iomanip>
  3.  
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8.     float tulips[]{15.5,12}, orchids[]{27,7}, mixed[]{3.95,35};
  9.     float baby[]{18.5,15}, cactus[]{7.65,18}, roses[]{19,21};
  10.     float tulipTotal=tulips[0]*tulips[1], orchidTotal=orchids[0]*orchids[1], mixedTotal=mixed[0]*mixed[1];
  11.     float babyTotal=baby[0]*baby[1], cactusTotal=cactus[0]*cactus[1], roseTotal=roses[0]*roses[1];
  12.     string allString[]={"Tulips", "Orchids", "Mixed Stems", "Baby Roses", "Cactus Plants", "Red Roses"};
  13.     cout<<left<<setw(15)<<"Name"<<setw(15)<<"Unit Price"<<setw(15)<<"Quantity Sold"<<"Total Sales"<<endl;
  14.     cout<<left<<setw(15)<<allString[0]<<setw(15)<<"$15.00"<<setw(15)<<"12"<<"$"<<tulipTotal<<endl;
  15.     cout<<left<<setw(15)<<allString[1]<<setw(15)<<"$27.00"<<setw(15)<<"7"<<"$"<<orchidTotal<<endl;
  16.     cout<<left<<setw(15)<<allString[2]<<setw(15)<<"$3.95"<<setw(15)<<"35"<<"$"<<mixedTotal<<endl;
  17.     cout<<left<<setw(15)<<allString[3]<<setw(15)<<"$18.50"<<setw(15)<<"15"<<"$"<<babyTotal<<endl;
  18.     cout<<left<<setw(15)<<allString[4]<<setw(15)<<"$7.65"<<setw(15)<<"18"<<"$"<<cactusTotal<<endl;
  19.     cout<<left<<setw(15)<<allString[5]<<setw(15)<<"$19.00"<<setw(15)<<"21"<<"$"<<roseTotal<<endl;
  20.     cout<<endl;
  21.     float allTotal[]{tulipTotal,orchidTotal,mixedTotal,babyTotal,cactusTotal,roseTotal};
  22.     float hold=0;
  23.     cout<<"Total Sales in Descending Order"<<endl;
  24.     for(int x=0;x<6;x++)
  25.     {
  26.         for(int c=0;c<6;c++)
  27.         {
  28.             if(allTotal[c]<allTotal[c+1])
  29.             {
  30.                 hold=allTotal[c+1];
  31.                 allTotal[c+1]=allTotal[c];
  32.                 allTotal[c]=hold;
  33.             }
  34.         }
  35.     }
  36.     for(int c=0;c<6;c++)cout<<allTotal[c]<<", ";
  37.     cout<<"\n\n";
  38.     string hold2="";
  39.     string allString2[]={"Tulips", "Orchids", "Mixed Stems", "Baby Roses", "Cactus Plants", "Red Roses"};
  40.     cout<<"Names in Alphabetical Order"<<endl;
  41.     for(int c=0;c<6;c++)
  42.     {
  43.         for(int x=0;x<6;x++)if(allString2[x]>allString2[x+1])
  44.         {
  45.             hold2=allString2[x];
  46.             allString2[x]=allString2[x+1];
  47.             allString2[x+1]=hold2;
  48.         }
  49.     }
  50.     for(int c=0;c<6;c++)cout<<allString2[c]<<", ";
  51.     cout<<"\n\n";
  52.     float low=999999, high=0;
  53.     float allQuantitys[]{tulips[1],orchids[1],mixed[1],baby[1],cactus[1],roses[1],};
  54.     for(int c=0;c<6;c++)
  55.     {
  56.         if(allQuantitys[c]>high)high=allQuantitys[c];
  57.         if(allQuantitys[c]<low)low=allQuantitys[c];
  58.     }
  59.     cout<<"The highest quantity sold is "<<high<<endl;
  60.     cout<<"The lowest quantity sold is "<<low<<endl;
  61.     return 0;
  62. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement