#include <iostream>
using namespace std;
#include <iomanip>
#include <string>
int main()
{
string name;
string number;
double bonusContributed;
const int FW = 10;
double const ticketPrice = 5;
int ticketsSold;
double revenuePercentage;
double moneyDistributed;
double revenueGenerated, adminDeduction, balanceRaised;
cout << "How many tickets were sold? ";
cin >> ticketsSold;
cin.ignore();
cout << "What percentage of the ticket revenue goes to administrative costs? ";
cin >> revenuePercentage;
getline (cin, number);
cout << "How much total money is distributed in prizes? ";
cin >> moneyDistributed;
cin.ignore();
cout << "What is the name of the charity? ";
getline (cin, name);
revenuePercentage = revenuePercentage /100;
revenueGenerated = ticketsSold * ticketPrice;
adminDeduction = revenueGenerated * revenuePercentage;
balanceRaised = revenueGenerated - (adminDeduction + moneyDistributed);
cout << fixed << showpoint << setprecision(2);
cout << "Charity: " << setw(FW) << "\"" << name << "\"" << endl;
cout << "Revenue Generated from ticket sales: $ " << setw(FW) << revenueGenerated << endl;
cout << "Amount deducted for administrative overhead: $ " << setw(FW) << adminDeduction << endl;
cout << "Amount deducted for prize movey: $ " << setw(FW) << moneyDistributed << endl;
cout << "Bonus contribution: $ " << setw(FW) << bonusContributed << endl;
cout << "Balance raised for charitable fund: $ " << setw(FW) << balanceRaised << endl;
if (ticketsSold >= 10,000)
{
if (ticketsSold >= 100,000)
bonusContributed = 25,000;
else if (ticketsSold >= 50,000)
bonusContributed = 15,000;
else if (ticketsSold >= 25,000)
bonusContributed = 8,000;
else if (ticketsSold >= 10,000)
bonusContributed = 3,000;
}
return 0;
}
>>> Got a warning but not sure how to fix it: "warning C4700: uninitialized local variable 'bonusContributed' used"
Also sorry if I posted in the wrong way, first time here :(