Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <iomanip>
- using namespace std;
- int main()
- {
- float tulips[]{15.5,12}, orchids[]{27,7}, mixed[]{3.95,35};
- float baby[]{18.5,15}, cactus[]{7.65,18}, roses[]{19,21};
- float tulipTotal=tulips[0]*tulips[1], orchidTotal=orchids[0]*orchids[1], mixedTotal=mixed[0]*mixed[1];
- float babyTotal=baby[0]*baby[1], cactusTotal=cactus[0]*cactus[1], roseTotal=roses[0]*roses[1];
- string allString[]={"Tulips", "Orchids", "Mixed Stems", "Baby Roses", "Cactus Plants", "Red Roses"};
- cout<<left<<setw(15)<<"Name"<<setw(15)<<"Unit Price"<<setw(15)<<"Quantity Sold"<<"Total Sales"<<endl;
- cout<<left<<setw(15)<<allString[0]<<setw(15)<<"$15.00"<<setw(15)<<"12"<<"$"<<tulipTotal<<endl;
- cout<<left<<setw(15)<<allString[1]<<setw(15)<<"$27.00"<<setw(15)<<"7"<<"$"<<orchidTotal<<endl;
- cout<<left<<setw(15)<<allString[2]<<setw(15)<<"$3.95"<<setw(15)<<"35"<<"$"<<mixedTotal<<endl;
- cout<<left<<setw(15)<<allString[3]<<setw(15)<<"$18.50"<<setw(15)<<"15"<<"$"<<babyTotal<<endl;
- cout<<left<<setw(15)<<allString[4]<<setw(15)<<"$7.65"<<setw(15)<<"18"<<"$"<<cactusTotal<<endl;
- cout<<left<<setw(15)<<allString[5]<<setw(15)<<"$19.00"<<setw(15)<<"21"<<"$"<<roseTotal<<endl;
- cout<<endl;
- float allTotal[]{tulipTotal,orchidTotal,mixedTotal,babyTotal,cactusTotal,roseTotal};
- float hold=0;
- cout<<"Total Sales in Descending Order"<<endl;
- for(int x=0;x<6;x++)
- {
- for(int c=0;c<6;c++)
- {
- if(allTotal[c]<allTotal[c+1])
- {
- hold=allTotal[c+1];
- allTotal[c+1]=allTotal[c];
- allTotal[c]=hold;
- }
- }
- }
- for(int c=0;c<6;c++)cout<<allTotal[c]<<", ";
- cout<<"\n\n";
- string hold2="";
- string allString2[]={"Tulips", "Orchids", "Mixed Stems", "Baby Roses", "Cactus Plants", "Red Roses"};
- cout<<"Names in Alphabetical Order"<<endl;
- for(int c=0;c<6;c++)
- {
- for(int x=0;x<6;x++)if(allString2[x]>allString2[x+1])
- {
- hold2=allString2[x];
- allString2[x]=allString2[x+1];
- allString2[x+1]=hold2;
- }
- }
- for(int c=0;c<6;c++)cout<<allString2[c]<<", ";
- cout<<"\n\n";
- float low=999999, high=0;
- float allQuantitys[]{tulips[1],orchids[1],mixed[1],baby[1],cactus[1],roses[1],};
- for(int c=0;c<6;c++)
- {
- if(allQuantitys[c]>high)high=allQuantitys[c];
- if(allQuantitys[c]<low)low=allQuantitys[c];
- }
- cout<<"The highest quantity sold is "<<high<<endl;
- cout<<"The lowest quantity sold is "<<low<<endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement