Hi!
I am doing a C++-program which I have to use functions.
The program is the following:
Write a function that calculates the fuelconsumption, it takes two numbers, litres and kilometers, and gives the consumption in litre per 100 km. The functions must write on screen in main.
Here is what I have now:
#include <iostream>
using namespace std;
double fuelconsumption(int litre, kilometer);
---------------------------------------------------------------------------
int main()
{
int gas;
cout << "How much gas has been used: " << endl;
cin >> liter;
cout << "How many kilomoters have you driven: " << endl;
cin >> kilometer;
double gas = fuelconsumption(liter, kilometer);
cout << "The fuelconsumption is " << gas << " litre per 100 km.";
cout << endl << endl;
return 0;
}
---------------------------------------------------------------------------
double fuelconsumption(int litre, kilometer)
{
double gas = litre / kilometer;
return gas;
}
Thanks in advance!
//Adam