needs help with code

Im trying to develop a program that will ask the user to enter the beginning and ending mileage submitted by sales people. From this data determine the total miles traveled and the mileage expense based on a rate of .42 per mile.

the input is salesman name, beginning mileage and ending mileage
this is what im tying to make


Salesman name: ===================== > (Name)
Beginning Mileage =================== > (Number)
Ending Mileage ===================== > (Number)


Salesman (Name) traveled (Number) miles and will be reimbursed (Number)


this is what i got so far with my code.


[code]
#include <string>
#include <iostream>
using namespace std;

double main()
{
cout << "Enter your name:";
cin >> name;

cout << "Enter beginning Mileage:";
cin >> start;

cout << "Enter ending Mileage:";
cin >> end;

cout << "caluculating...";
result = beginning mileage/ending mileage*.42
cout << "reimbursed:<<results;
system("pause");

}
[code]
Your equation to determine the total number of miles traveled is wrong.

double main()
This is fantastically wrong and an error I don't think I've seen before. Where did you get it? In correct C++ code, main() returns an int, always always always.
Last edited on
1. main returns int.

2. You must have return keyword in the program that returns.

for main,an int. return 0 if no problem occured otherwise return 1.
hentaiw wrote:
You must have return keyword in the program that returns.
main() is an exception. If you leave out the return in main it will be the same as return 0;
@Peter87 : It's a good practice anyway. :)
Topic archived. No new replies allowed.