This program should calculate electricity bills......but it dosen't compile in Dev C++
Thanks!!Code:#include<iostream> using namespace std; int main() { char name[50]; int units; float total; start: /*Getdata*/ cout<<"\n\nEnter the costumer's name::"; cin.getline(name,49,"\n"); /*Problems are in this line*/ cout<<"\n\nEnter no. of units used::"; cin>>units; /*calculate*/ if(units<=100) total=units*60/100; else if(units<=300) total=60+((units-100)*80/100); else if(units>300) total=220+((units-300)*90/100); if(total<50) total=50; if(total>300) total=total+(0.15*total); /*display*/ cout<<endl<<"Customer's name:"<<name<<endl; cout<<"Units:"<<units<<endl; cout<<"TOTAL:Rs."<<total<<"only"<<endl; cout<<"Another Bill?(y/n)"; char ano; cin>>ano; if(ano=='y') goto start; cin.get(); return 0; }



LinkBack URL
About LinkBacks



