Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- class Bank {
- private:
- double balance; //Баланс
- short int id; //ID
- double monI; //Сколько положили
- public:
- void addBalance(double sum) { //Положить деньги на счёт
- balance = this->balance + sum;
- monI = sum;
- }
- double getBalance() {
- return this->balance;
- }
- short getId() {
- return this->id;
- }
- Bank(double b, short int i) : balance(b), id(i) {
- }
- };
- int main() {
- setlocale(LC_ALL, "ru");
- Bank card1 = Bank(10, 1); //Создание счёта 1
- double sum = 200.7;
- card1.addBalance(sum);
- cout << "Вы положили: " << sum << " на счёт" << card1.getId() << endl;
- cout << "Баланс: " << card1.getBalance() << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement