Added missing files and removed unnessesary ones

This commit is contained in:
2023-07-16 16:44:42 +03:00
parent c3fa5367c3
commit 199dd693e4
41 changed files with 1442 additions and 50 deletions

16
C++/lesson6/task1.cpp Normal file
View File

@ -0,0 +1,16 @@
#include <iostream>
#include <string>
class Person {
private:
std::string name;
public:
Person(const std::string& name) {
this->name = name;
}
void printName() {
std::cout << this->name << '\n';
}
};

47
C++/lesson6/task2.cpp Normal file
View File

@ -0,0 +1,47 @@
#include <iostream>
#include <string>
class Student {
std::string name;
int age;
double average_grade;
public:
Student(std::string name, int age, double average) {
this->name = name;
this->age = age;
this->average_grade = average;
}
std::string& get_name() {
return name;
}
int get_age() {
return age;
}
double get_average_grade() {
return average_grade;
}
void status() {
if (average_grade >= 4 && average_grade < 5) {
std::cout << "Student is хорошист" << '\n';
} else if (average_grade = 5) {
std::cout << "Student is отличник" << '\n';
} else if (average_grade < 3) {
std::cout << "Student is двоечник" << '\n';
}
}
};
int main() {
Student student1("George", 19, 3.5);
Student student2("Paul", 14, 4.8);
Student student3("Vasyok", 17, 5);
student1.status();
student2.status();
student3.status();
}

40
C++/lesson6/task3.cpp Normal file
View 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();
}