I need help trying to calculate wins and loss and ratio for C++ and im lost can someone please help?
Here's the code
#include <iostream>
using namespace std;
int main( )
{
int year1Win, year2Win, year3Win, year4Win, year5Win;
double AverageWin;
cout << "Enter the number of win for year 1: ";
cin >> year1Win;
cout << "Enter the number of win for year 2: ";
cin >> year2Win;
cout << "Enter the number of win for year 3: ";
cin >> year3Win;
cout << "Enter the number of win for year 4: ";
cin >> year4Win;
cout << "Enter the number of win for year 5: ";
cin >> year5Win;
AverageWin = (year1Win + year2Win + year3Win + year4Win + year5Win)/5;
cout << "Five year Average Win for this team is: " << AverageWin;
system("pause");
return 0;
}
{
#include <iostream>
using namespace std;
int main( )
int year1Loss, year2Loss, year3Loss, year4Loss, year5Loss;
double AverageLoss;
cout << "Enter the number of loss for year 1: ";
cin >> year1Loss;
cout << "Enter the number of loss for year 2: ";
cin >> year2Loss;
cout << "Enter the number of loss for year 3: ";
cin >> year3Loss;
cout << "Enter the number of loss for year 4: ";
cin >> year4Loss;
cout << 'Enter the number of loss for year 5: ";
cin >> year5Loss;
AverageLoss = (year1Loss + year2Loss + year3Loss + year4Loss + year5Loss)/5;
cout << "Five year Average Loss for this team is: " << AverageLoss;
#include <iostream>
usingnamespace std;
int main()
{
int losses[5], counter = 0;
while(counter <= 4)
{
cout<<"Enter the number of losses for year "<< counter + 1<<:";
cin>> losses[counter];
}
for(int avgLoss = 0, counter = 0; counter <= 4; counter++)
{
avgLosses += losses[counter];
}
cout<<"Five year average loss forthis team is: "<< average loss << endl;
}