Advertisement
ByMsx

Untitled

Feb 20th, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. class Bank {
  6. private:
  7.     double balance; //Баланс
  8.     short int id; //ID
  9.     double monI; //Сколько положили
  10. public:
  11.     void addBalance(double sum) {     //Положить деньги на счёт
  12.         balance = this->balance + sum;
  13.         monI = sum;
  14.     }
  15.  
  16.     double getBalance() {
  17.         return this->balance;
  18.     }
  19.  
  20.     short getId() {
  21.         return this->id;
  22.     }
  23.  
  24.     Bank(double b, short int i) : balance(b), id(i) {
  25.  
  26.     }
  27. };
  28.  
  29. int main() {
  30.     setlocale(LC_ALL, "ru");
  31.  
  32.     Bank card1 = Bank(10, 1); //Создание счёта 1
  33.  
  34.     double sum = 200.7;
  35.    
  36.     card1.addBalance(sum);
  37.     cout << "Вы положили: " << sum << " на счёт" << card1.getId() << endl;
  38.     cout << "Баланс: " << card1.getBalance() << endl;
  39.  
  40.     return 0;
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement