41 lines
867 B
C++
41 lines
867 B
C++
#include <iostream>
|
|
|
|
struct Account {
|
|
int number;
|
|
int money;
|
|
int percentage;
|
|
|
|
public:
|
|
Account(int number, int money, int percentage) {
|
|
this->number = number;
|
|
this->money = money;
|
|
this->percentage = percentage;
|
|
}
|
|
|
|
void refill(int amount) {
|
|
money += amount;
|
|
}
|
|
|
|
void withdraw(int amount) {
|
|
money -= amount;
|
|
}
|
|
|
|
void PrintInformation() {
|
|
std::cout << number << ' ' << money << ' ' << percentage << '\n';
|
|
}
|
|
};
|
|
|
|
int main() {
|
|
Account* account1 = new Account(21213, 500, 15);
|
|
account1->PrintInformation();
|
|
account1->refill(200);
|
|
account1->withdraw(50);
|
|
account1->PrintInformation();
|
|
|
|
Account* account2 = new Account(1934, 800, 10);
|
|
account2->PrintInformation();
|
|
account2->refill(150);
|
|
account2->withdraw(23);
|
|
account2->PrintInformation();
|
|
}
|