this is the program i have and i keep getting these 3 errors when building it
1>m:\my documents\visual studio 2005\projects\cobytown2.cpp(25) : error C2059: syntax error : ')'
1>m:\my documents\visual studio 2005\projects\cobytown2.cpp(30) : error C2181: illegal else without matching if
1>m:\my documents\visual studio 2005\projects\cobytown2.cpp(30) : error C2059: syntax error : ')'
Code:// this program will calculate the viallage of cobytowns water bill for it's customers #include <iostream> #include <iomanip> #include <fstream> #include <string> using namespace std; int main() { string type, name,acctyp; const double metchar=5.00; const double resident=.20; const double business=.30; double oldreading,newreading,waterused,totaldue,watercharge; cout<<"Please enter the customers name:"; cin>>name; cout<<"Please enter the customers account type:"; cin>>acctyp; cout<<"Please enter the customers old reading:"; cin>>oldreading; cout<<"Please enter the customers new reading:"; cin>>newreading; waterused=newreading-oldreading; if (acctyp=)"R"; { watercharge=(waterused/100)*resident; type="resident"; } else if (acctyp=)"B"; { watercharge=(waterused/100)*business; type="business"; } cin.get(); cout<<"JOHN DOE"<<endl<<endl<<endl; cout<<setw(60)<<"VILLAGE OF COBYTOWN WATER BILL\n\n\n\n"; cout<<setw(40)<<"Customers name:"<<name<<endl; cout<<setw(40)<<"Customers account type:"<<acctyp<<endl<<endl; cout<<setw(40)<<"Old reading:"<<oldreading<<endl; cout<<setw(40)<<"New reading:"<<newreading<<endl<<endl; cout<<setw(40)<<"Water used:"<<waterused<<endl<<endl; cout<<setw(40)<<"Water charge:"<<watercharge<<endl; cout<<setw(40)<<"Meter rental:"<<metchar<<endl; cout<<setw(40)<<"---------"<<endl; totaldue=metchar+watercharge; cout<<setw(40)<<"TOTAL DUE:$"<<totaldue<<endl; }



LinkBack URL
About LinkBacks


