I'm trying to pass the total from another function to the main function but I'm having trouble. I keep getting 1.5 instead of 7. What am I doing wrong?
#include <iostream>
usingnamespace std;
double order();
int main() // fixed
{
double total;
double salesTotal;
total= order(); //functions that have a type other than void
//are usually found on the right side of an assignment to capture the value returned.
salesTotal=total+1.50;
cout << salesTotal;
return 0;
}
double order()
{
double total;
total=5.50;
return total;
return 5.5; //you don't need all that for a constant.
}