using function for MPH
Im new to functions and im not sure why I cant get this to run?? any help would be greatly appreciated! :)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
|
#include<iostream>
using namespace std;
void f(int &, int &, double);
void f(int & miles, int & hours, double milesPerHour)
{
milesPerHour = miles / hours;
}
{
int main()
{
cout << "Please enter the miles traveled" <<endl;
cin >> miles;
cout << "Please enter the hours traveled" <<endl;
cin >> hours;
cout << setprecsion(2) << fixed;
cout << "your speed is " << f(miles, hours) << " miles per hour" <<endl;
system("pause");
return 0;
}
|
miles and hours aren't declared anywhere.
so should I enter them as an integer in the main?
I figured it out, Thank you!
Topic archived. No new replies allowed.