ok I want to display a msg and terminate the program if tiksold=0 or less, I dont think im writing this right
Code:// Marcus Molineaux csit 802 assignment 3 t th 645 #include <iostream> #include <string> #include <iomanip> using namespace std; int main() { double tiksold; double newadmpt, mondist, revgen,amnovrhd,monraised,admpct; double bonusContribution; string charname; const double tikprice=5.00; cout<<"How many tickets were sold? "<<endl; cin>>tiksold; if (tiksold=0) cout<<"Please enter a positive number"<<endl; exit(); cout<<"What percent goes to administrative costs (type in whole number)? "<<endl; cin>>admpct; newadmpt=admpct/100; cout<<"How much prize money was distributed? "<<endl; cin>>mondist; cout<<"What is the name of the charity? "<<endl; cin.ignore(); getline (cin,charname); revgen=tiksold*tikprice; amnovrhd=newadmpt*revgen; if (tiksold<10000) bonusContribution=0; else if (tiksold>10000 && tiksold<25000)bonusContribution=3000; else if (tiksold>24999 && tiksold<50000)bonusContribution=8000; else if (tiksold>49999 && tiksold<100000)bonusContribution=15000; else if (tiksold>99999)bonusContribution=25000; monraised=((revgen-amnovrhd)-mondist)+bonusContribution; cout << fixed << showpoint << setprecision(2); cout<<"Charity: "<<setw(12)<<charname<<endl; cout<<"Revenue generated: $"<<setw(12)<<revgen<<endl; cout<<"Administrative overhead: $"<<setw(12)<<amnovrhd<<endl; cout<<"Deducted prize money: $"<<setw(12)<<mondist<<endl; cout<<"Bonus Contribution $"<<setw(12)<<bonusContribution<<endl; cout<<"Money raise for charitable fund: $"<<setw(12)<<monraised<<endl; return 0; }



LinkBack URL
About LinkBacks



