Hi There,
Hope you can help with this. I have created a void function which has to add the totals and return the values to the main section for display. For some reason it does not return the totals. I tried everything I know. I also put displays in the function to see if it gets the parameters. It does but does not bring back the value. Please help.
#include <iostream>
#include <string>
using namespace std;
void inputAndValidate(char Position, int Points)
{
while((Position == 'B') || (Position == 'F'))
{
cout << "Pleas e enter the position: ";
cin >> Position;
cout << "Please enter the Points: ";
cin >> Points;
}
}
void updateCorrectTotal(char posi, int poin, int tFoward, int tBack)
{
if (posi == 'F')
tFoward += poin;
else
tBack += poin;
}
//
int main()
{
char position;
int points, totForward, totBack;
totForward = 0;
totBack = 0;
points = 0;
inputAndValidate(position, points);
updateCorrectTotal(position, points, totForward, totBack);
cout << "Total number of points scored by forwards: "
<< totForward << endl;
cout << "Total number of points scored by backs: "
<< totBack << endl;
return 0;
}