|
hello ive just started learning c++ and im really stuck. the program doesnt seem to beable to read the if statement properly
# include <iostream>
using namespace std;
int getDaysHire(int);
int calculateCharge(int daysHire, int seasonCharge);// my two function prototypes
int main()
{
int x;
int season;
int cost;
int DaysHire;
int seasonCharge;
int days;
cout << " Enter the number of days you wish to rent a bicycle. Bearing in mind that a £25 deposit must be paid";
cout << " The maxium days allowed is 15 and if you rent over 8 days you will get a 10% discount.";
days = getDaysHire(x);// function call
cost = calculateCharge(DaysHire,seasonCharge);
cout << "the cost is" << cost << endl; // my output statement
system("PAUSE");
// wait until user is ready before terminating program
// to allow the user to see the program results
return 0; // program has ended
}
int getDaysHire(int days)// function defination
{
cin >> days;// user inputs days that they want to rent a bicycal for
if (days <= 15)
cout <<" ok";
else if (days > 15)
{
cout << "read the instructions moron, ENTER DAYS LESS THAN 15";
cin >> days;
}
return days;
}
int calculateCharge(int DaysHire, int seasonCharge)
{
int cost,season,high,low,days;
cout <<"is it high season or low season";
cin >> season;
if (season == low && days >8)
cost =(((5+25/100)*10)*days);
else if ( season == high && days >8)
cost =(((10+25/100)*10)*days);
else if (season == low && days <8)
cost =((5+25)*days);
else if ( season == high && days <8)
cost =((10+25)*days);
return cost;
}
thank you foer helping
|