#include <iostream.h>
#include <conio.h>
void gas();
void main()
{
float gal;
while(gal<=0)
gas();
cout<<"thanks for your help";
getch();
}
void gas()
{
float gal;
float total;
float miles;
float avg;
cout <<"enter the gallons of gas used (-1 to end): ";
cin >> gal;
cout <<"enter miles driven: ";
cin >> miles;
avg=miles/gal;
cout <<"the miles / gallon for this tank was "<<avg<<endl;
cout<<"\n";
}
------------------------------------------------------------------------------
i'm tring to get float gal value to be shared between gas and main.
so that if -1 is enter for gal the while loop will exit.
help would be aprecaited.