Guys help me!
My codes are correct but it didn't output the results of my program
Please help me to my project
#include<iostream>
using namespace std;
int telephone_bill()
{ int choice, min, tbill, coun, con;
cout<<"Welcome to Telephone Bill Service!";
cout<<"\nChoose if\n <1>Local Call <2>International Call";
cout<<"\nYour choice:";
cin>>choice;
if (choice==1)
{system("cls");
cout<<"\nThe rate for Local Call is 3.00PhP.";
cout<<"\nHow many minute(s):";
cin>>min;
tbill=min*3;
cout<<"\nYour total Telephone Bill is "<< tbill<<".00";
}
else if (choice==2)
{system("cls");cout<<"\nChoose a country:";
cout<<"\n1. America\t\t2.Europe\n3.Australia\t\t4.Singapore";
cout<<"\nCountry:";
cin>>coun;
if (coun==1)
{system("cls");cout<<"\nThe rate for call to America is 10.00.";
cout<<"\nHow many minute(s):";
cin>>min;
tbill=min*10;
cout<<"\nYour total Telephone Bill is "<<tbill<<".00";
}
else if (coun==2)
{system("cls");cout<<"\nThe rate for call to Europe is 12.00.";
cout<<"\nHow many minute(s):";
cin>>min;
tbill=min*12;
cout<<"\nYour total Telephone Bill is "<<tbill<<".00";
}
else if (coun==3)
{system("cls");cout<<"\nThe rate for call to Australia is 8.00.";
cout<<"\nHow many minute(s):";
cin>>min;
tbill=min*8;
cout<<"\nYour total Telephone Bill is "<<tbill<<".00";
}
else if (coun==4)
{system("cls");cout<<"\nThe rate for call to Singapore is 6.00.";
cout<<"\nHow many minute(s):";
cin>>min;
tbill=min*6;
cout<<"\nYour total Telephone Bill is "<<tbill<<".00";
}
else
{system("cls");cout<<"\nError!";
return 0;
}
}
else
{cout<<"\nError!";
cout<<"\nProgram Terminated.";
}
}
int electric_bill()
{ int kw,balance,k;
double ebill, ebill1,disc;
cout<<"Welcome to Electric Billing Service!";
cout<<"\n\nThe rate of electric per kilowatt hour is 5.00.";
cout<<"\n\nEnter your Electric Consumption:";
cin>>kw;
ebill1=kw*5;
if (kw>=500)
{cout<<"\n\nYou have 10% Discount on your total bill!";
disc=(ebill1*0.1);
ebill=(ebill1-disc);
cout<<"\nYou have discount of "<<disc<<".00";
cout<<"\n\nYour Electric Bill with Discount is "<<ebill1<<".00";
}
else
{cout<<"\nSorry You don't have discount.";
disc=0;
cout<<"\nYour Total Electric is "<<ebill1<<".00";
}
cout<<"\n\nDo you have any balance on your last bill?";
cout<<"\n<1>Yes\t<2>No\n";
cout<<"Your Choice:";
cin>>k;
if (k==1)
{cout<<"\n\nYour ramaining balance:";
cin>>balance;
ebill=(ebill1+balance)-disc;
cout<<"\n\nYour total Electric bill is "<<ebill<<".00";
}
else if (k==2)
{ebill=ebill1-disc;
cout<<"Your Total Bill is "<<ebill<<".00";
}
else
{cout<<"\n\nError!";
}}
int water_bill()
{ int wat, q;
double wbill, wbill1,bal,discount;
cout<<"Welcome to Water Billing Services!";
cout<<"\n\nThe rate for water is 3.00.";
cout<<"\n\nEnter your Water Consumption:";
cin>>wat;
wbill1=wat*3;
if (wat>=500)
{cout<<"\n\nYou have a 10% Discount on your bill!";
discount=wbill1*0.10;
cout<<"\n\nYour bill is "<<wbill1<<".00";
cout<<"\nYou've discounted by "<<discount<<".00";
}
else
{cout<<"\n\nSorry, You don't have discount.";
discount=0;
cout<<"\n\nYour bill is "<<wbill1<<".00";
}
cout<<"\n\nDo you have any balance on your last bill?";
cout<<"\n<1>Yes\t<2>No\n";
cout<<"Your Choice:";
cin>>q;
if (q==1)
{cout<<"\n\nYour ramaining balance:";
cin>>bal;
wbill=(wbill1+bal)-discount;
cout<<"\n\nYour total Water bill is "<<wbill<<".00";
}
else if (q==2)
{wbill=wbill1-discount;
cout<<"Your Total Bill is "<<wbill<<".00";
}
else
{cout<<"\n\nError!";
}
}
int main()
{ int a;
cout<<"Welcome to Bayad Center!";
cout<<"\nPlease choose a service:";
cout<<"\n<1>Telephone Billing Service\n<2>Electric Billing Service\n<3>Water Billing Service\n<4>Exit";
cout<<"\nYour Choice:";
cin>>a;
switch (a)
{ case 1: system("cls");system("Color 3D");telephone_bill();
break;
case 2: system("cls");system("Color 1F");electric_bill();
break;
case 3: system("cls");system("Color 4E");water_bill();
break;
case 4: system("cls");system("Color 9F");cout<<"\nProgram Terminated.";
break;
default: cout<<"\nError!";
}
You put Electric Billing Service next to Water Billing Service. This is causing a short circuit.
Also if the screen isn't clearing either possibly add include <windows.h> if you are on windows or, if you are on linux, replace system("cls") with system("clear"), which is something I googled in the name of the people.
Sir rodiongork
can you help me to solve the short-circuit in my program 'coz it makes me dizzy thinking about this problem :|
Thanks to your Help and God bless :D