Apr 29, 2009 at 12:15am UTC
I have a program that I cant figure out what is wrong with it. I get certain errors when I try to compile it. Any help would be GREATLY Appreciated.
The Error i get is: error: expected unqualified-id before â{â token
Here is the Program:
//William McDonald
#include <iostream>
using namespace std;
void airfare(double &airfareCost, double &airfareAllowed);
void milage(int &miles, double &milageCost, double &milageAllowed);
void taxi(int &taxiDays, double &taxiCost, double &taxiAllowed);
int main()
{
int taxiDays, miles;
double airfareCost, airfareAllowed;
double milageCost, milageAllowed;
double taxiCost, taxiAllowed;
airfare(airfareCost, airfareAllowed);
milage(miles, milageCost, milageAllowed);
taxi(taxiDays, taxiCost, taxiAllowed);
cout<<"Airfare Cost="<<airfareCost<<endl;
cout<<"Airfare Allowed="<<airfareAllowed<<endl;
cout<<"Milage Cost="<<milageCost<<endl;
cout<<"Milage Allowed="<<milageAllowed<<endl;
cout<<"Taxi Cost="<<taxiCost<<endl;
cout<<"Taxi Allowed="<<taxiAllowed<<endl;
return 0;
}
void airfare(double &airfareCost, double &airfareAllowed);
{
cout<< "Enter cost of Airfare"<<endl;
cin>>airfareCost;
airfareAllowed=airfareCost;
}
void milage(int &miles, double &milageCost, double &milageAllowed)
{
cout<< "Enter Number of miles driven"<<endl;
cin>>miles;
cout<< "Enter Milage Cost"<<endl;
cin>>milageCost;
milageAllowed=miles*0.38;
}
void taxi(int &taxiDays, double &taxiCost, double &taxiAllowed)
{
cout<<"Enter number of days taxi was used"<<endl;
cin>>taxiDays;
cout<<"Enter Taxi Cost"<<endl;
cin>>taxiCost;
taxiAllowed=taxiDays*10;
}
Apr 29, 2009 at 12:29am UTC
remove ";" at the end of---
void airfare(double &airfareCost, double &airfareAllowed);
then it compiles
Last edited on Apr 29, 2009 at 12:29am UTC
Apr 29, 2009 at 1:07am UTC
i still get the same error
Apr 29, 2009 at 1:11am UTC
He means the semi-colon here if you don't know where kyle means.
You have
1 2 3 4 5
void airfare(double &airfareCost, double &airfareAllowed);
{
cout<< "Enter cost of Airfare"<<endl;
cin>>airfareCost;
airfareAllowed=airfareCost;
}
After your remove it do a clean build.
[EDIT]Fixed noob mistake :)
Last edited on Apr 29, 2009 at 5:05am UTC
Apr 29, 2009 at 1:25am UTC
I did remove it. But i still seem to get the same error.
Apr 29, 2009 at 1:55am UTC
What compiler are you using?
Apr 29, 2009 at 2:24am UTC
Got it to work! Thanks all! Been to 3 different forums in the last week and this was the first to reply.
Last edited on Apr 29, 2009 at 2:34am UTC
Apr 29, 2009 at 2:41am UTC
What ended up being the problem out of curiosity?
Apr 29, 2009 at 2:43am UTC
void airfare(double &airfareCost, double &airfareAllowed
I accidently deleted the ) when i deleted the :
Apr 29, 2009 at 3:16am UTC
Mythios: Shirley, you mean "semicolon".
Apr 29, 2009 at 4:10am UTC
Even though I know it's spelled like that - I still have this issue of using my '-' key to much. So I write it like it without even realizing lol :(
Apr 29, 2009 at 4:51am UTC
Perhaps helios's point was for the spelling of colon which you wrote as column. :D
Apr 29, 2009 at 5:03am UTC
Ahahah oh god - I didn't pick that up I didn't realize i actually did that. /slap hand. Was all his fast typing fault.