C++ program piggy bank?
definitely guys intravenous just started off this program in c++ and i have the shape of that as u can easily see it down below.can anybody help us out to obtain it to your workplace please
#include
using namespace an std;
int main()
int decision;
cout << "Welcome to be able to my Piggy Bank"<<endl;
cout<<"\n n:Deposit";
cout<<"\n w:Withdraw";
cout<<"\n s:Show total";
cout<<"\n e:Empty";
cout<<"\n queen:Quit";
cout<<"\n I highly recommend you enter a new choice";
cin>>choice;
change (choice)
case ‘d’:
cout <<" Deposit"<<endl;
crack;
case ‘w’:
cout <<"withdraw"<<endl;
crack;
case ‘s’:
cout <<"show total"<<endl;
crack;
case ‘e’:
cout <<"empty"<<endl;
crack;
case ‘q’:
cout <<"quit"<<endl;
crack;
default:
cout <<"Please enter different options:"<<endl;
crack;
go back 0;
You include declare alternative as int choice
The idea should expressed as char choice, as you are inputting a character.
Here is the code
#include
using namespace an std;
int main()
char decision;
cout << "Welcome to be able to my Piggy Bank"<<endl;
cout<<"\n n:Deposit";
cout<<"\n w:Withdraw";
cout<<"\n s:Show total";
cout<<"\n e:Empty";
cout<<"\n queen:Quit";
cout<<"\n I highly recommend you enter a new choice";
cin>>choice;
change (choice)
case ‘d’:
cout <<" Deposit"<<endl;
crack;
case ‘w’:
cout <<"withdraw"<<endl;
crack;
case ‘s’:
cout <<"show total"<<endl;
crack;
case ‘e’:
cout <<"empty"<<endl;
crack;
case ‘q’:
cout <<"quit"<<endl;
crack;
default:
cout <<"Please enter different options:"<<endl;
crack;
go back 0;
Although loop can be better
Thank you, Hope the item helps
Firstly, your header file ought to be #include
After that, I could suggest that you use quantities 1, ONLY TWO, 3 et cetera instead connected with alphabets like d, w, s, e, as well as q.
Then it ought to be working completely:).
Leave a Reply
You must be logged in to post a comment.