-
Syntax problem
I am a newbie to programming and I have a problem. I need to put this in the correct syntax.
Daily bonus points are accrued at 300 points for every three days.
Mileage bonus points are are accured at 250 points for every 300 miles driven.
Bonus points are not prorated.
Please help me put this into a correct syntax :confused:
-
show us what you have so far?
-
here im not sure exactly what you are needing,
so ill post this, it needs alot of work, and will not
work correctly unless the amounts are evenly divided.
Code:
#include <iostream>
using namespace std;
int main()
{
int days, miles;
cout << "how many days?" << endl;
cin >> days;
cout << "how many miles?" << endl;
cin >> miles;
cout <<"# of points : ";
cout << (days * 100) + ((miles/300) * 250) << endl;
cin.ignore( 100 , '\n' );
cin.get();
return 0;
}
Code:
output : 1250 points
with 10 days and 300 miles.
-
I need a math solution I guess. I want to be able to put in any number of miles driven and the number of rented and have it compute the bonus points.
-
number of days divided by 3 is the number of times you will multiply by 300 to get number of daily bonus points. This works because in C++ if you use division of integers by integers you get an integer, with any decimal portion ignored-- which correlates with the statement that proration of points will not be allowed.
number of miles driven divided by 300 is the number of times you will muliply by 250 to get the number of miles bonus points.
Total bonus points is the sum of the two types of bonus points.
-
nah no need to divide days by 3, just use 1 day = 100 points
unless of course you dont get any points unless it
been 3 days. then you will need to do that.
-
You guys are great. My program is perfect. I did the calculations in the way you described above and it worked perfectly. Thank You So Much!!!!!