I think you have the answers by now. Since this is C++, I wanted to point out something about your code. You have a set of variables declared :
const double KM5_FEE= 65.00;
const double KM10_FEE = 100.00;
const double KM15_FEE= 150.00;
double income_5=0;
double income_10=0;
double income_15;
int count_fee5=0;
int count_fee10 = 0;
int count_fee15 =0;
and to me they appear to lend themselves to a class organization. Something like this :
class Entry
{
public: double m_fee { 0 };
double m_income { 0 };
double m_count { 0 };
public: Entry() {}
Entry( double fee, double income=0, double count=0 )
{
Set( fee, income, count );
}
void Set( double fee, double income=0, double count=0 )
{
m_fee = fee;
m_income = income;
m_count = count;
}
void Register()
{
m_income += m_fee;
++m_count;
}
};
to construct some you can do this :
Entry entry05( 65 );
Entry entry10( 100 );
Entry entry15( 150 );
this will make the
switch
statement in your code look like this :
switch(choice)
{
case 1:
entry05.Register();
break;
case 2:
entry10.Register();
break;
case 3:
entry15.Register();
break;
}
I will leave this rest of it for you to figure out.
This is just something for you to consider since you have classes available to you. I think the use of a class for this can simplify your logic considerably.