Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <vector>
- #include <string>
- using namespace std;
- class Student {
- public:
- int group; ///класс -- поля
- int age; ///возраст
- string name; //имя
- double grade; //оценка
- void hi() {
- cout << "Привет, я " << name << ", мне " << age << " лет!\n";
- }
- int solve(int a, int b) {
- return a + b;
- }
- };
- int main() {
- Student vasya;
- vasya.age = 15;
- vasya.group = 8;
- vasya.name = "Вася";
- vasya.grade = 5;
- vasya.hi();
- Student petya;
- petya.age = 12;
- petya.group = 6;
- petya.name = "Петя";
- petya.grade = 3;
- petya.hi();
- vasya.hi();
- cout << petya.age << ' ' << vasya.age << '\n';
- cout << petya.solve(10, 8);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement