hello, i have write a program and when i compile it, it say that one of my variable 'advance', is a ambiguous symbol and cannot be used....why? after i change the 'advance' to other word, like 'advanced', it run nicely....but why 'advance' word is ambiguous in this program?
#include <iostream>
using namespace std;
double commission (double sales);
double pay, sales, advance ,com,rate;
int main ()
{
cout<<"What is your monthly sales? "<<endl;
cin>>sales;
cout<<"How much advanced pay you have drawn? "<<endl;
cin>>advance;
commission (sales);
cout<<"your commission is RM "<<sales*rate/100<<endl;
cout<<"After subtractring the advanced pay.... "<<endl;
pay=(sales*rate/100)- advance;
cout<<"\n*****************************************************"<<endl;
cout<<"Your total commission pay is RM "<<pay<<endl;
cout<<"*****************************************************\n"<<endl;
if (pay<0)
cout<<"You must reimburse the company a total of RM "<<-1*pay<<" !!\n"<<endl;
return 0;
}
double commission (double sales)
{
if (sales<10000) rate=5;
if (sales>=10000&&rate<15000) rate=10;
if (sales>=15000&&rate<18000) rate=12;
if (sales>=18000&&rate<22000) rate=14;
if (sales>=22000) rate=16;
cout<<"\nCommission rate = "<<rate<<"%"<<endl;
return rate;
}