Added missing files and removed unnessesary ones
This commit is contained in:
40
C++/lesson6/task3.cpp
Normal file
40
C++/lesson6/task3.cpp
Normal file
@ -0,0 +1,40 @@
|
||||
#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();
|
||||
}
|
Reference in New Issue
Block a user