What's wrong with my program? It will compile and run but doesn't do the calculations. It also says my variables are being used without being initialized. Please help. Thanks!
#include<iostream>
using namespace std;
int main ()
{
double stMileage;
double endMileage;
double stFuel;
double endFuel;
I'm sorry, I'm not really sure how to fix that.
I wrote another program with a similar format and it worked fine.
Is the positioning of the variable declarations wrong?
It's a simple mistake that i've made many times (and occasionally still do)...
for example: you're trying to declare "miTrvld" as "stMilage - endMileage" but these two variables are still set as 0.
So what's happening is "miTrvld = 0 * 0"
FIX= Have all your questions BEFORE your calculations.
Then you'll have the actual values to be able to do the calculations with!
EDIT: you can still declare your variables first if you like and then assign them later but if you do this DO NOT declare you final values as constants...