Run Code
|
API
|
Code Wall
|
Users
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Blog
005#
#include <cstdio> #include <cstdlib> #include <iostream> using namespace std; int newMoney; int currentMoney; int chose; class BankAccount { public: int deposit(int newMoney, int currentMoney){ return newMoney + currentMoney; } public: int withDrawal (int newMoney, int currentMoney){ return newMoney - currentMoney; } public: string askingChose (){ cout << "Press 1: to deposit money.\nPress 2: to withdrawal money.\n"; } }; int main () { BankAccount accountObject; accountObject.askingChose(); if (chose == 1) { cout << "Enter deposit amount: "<< endl; cin >> newMoney; } else { if (chose == 2) { cout << "Enter withDrawal amount: " <<endl; cin >> chose; } esle { cout << "You must enter a valid chose between 1 and 2"<< endl; } } return 0; }
run
|
edit
|
history
|
help
0
Please
log in
to post a comment.
Shorting in one line using class members std and boost bind
constructing object on first use as return value of (pointer to) object-returning function
Próba
Zadanie Kolokwium 2013: Trójkąty i trójkąty
Policy based smart pointer
<string> Indirect include of <errno.h> with gcc
march long ques 4
stlsizeof.cc
4149 coj WIP
3
Please log in to post a comment.