Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

a #75

Open
wants to merge 52 commits into
base: main
Choose a base branch
from
Open

a #75

Show file tree
Hide file tree
Changes from 47 commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
ef9bef0
Create 1
DreadMaks Dec 21, 2021
dc727d6
Add files via upload
DreadMaks Dec 21, 2021
b5ba423
Delete Task1 directory
DreadMaks Dec 23, 2021
1e2f6d3
Create 1
DreadMaks Dec 23, 2021
bf5ebae
Add files via upload
DreadMaks Dec 23, 2021
b1b603a
Update 1.cpp
DreadMaks Dec 23, 2021
ed25927
Add files via upload
DreadMaks Dec 23, 2021
704baab
Update and rename 2.cpp to 1.2.cpp
DreadMaks Dec 23, 2021
c63044c
Rename 1.cpp to 1.1.cpp
DreadMaks Dec 23, 2021
7d3e929
Update 1.1.cpp
DreadMaks Dec 23, 2021
afbbfe9
Update 1.2.cpp
DreadMaks Dec 23, 2021
111c88f
Add files via upload
DreadMaks Dec 23, 2021
a20a8c3
Delete 1.3.cpp
DreadMaks Dec 23, 2021
12f704c
Add files via upload
DreadMaks Dec 23, 2021
7f9bb20
Update 1.3.cpp
DreadMaks Dec 23, 2021
0e97e03
Delete 1
DreadMaks Dec 23, 2021
27b0257
Add files via upload
DreadMaks Dec 23, 2021
7d0b166
Add files via upload
DreadMaks Dec 23, 2021
07120db
Add files via upload
DreadMaks Dec 23, 2021
2f7d8f9
Add files via upload
DreadMaks Dec 23, 2021
395ec98
Create 1.cpp
DreadMaks Dec 23, 2021
e9b6a50
Create 3.cpp
DreadMaks Dec 23, 2021
423a864
Delete Task 4 directory
DreadMaks Dec 23, 2021
c02344d
Create 1.cpp
DreadMaks Dec 23, 2021
e694871
Create 3.cpp
DreadMaks Dec 23, 2021
e427f19
Create 4.cpp
DreadMaks Dec 23, 2021
da1723c
Create 5.cpp
DreadMaks Dec 24, 2021
47ed1f1
Create 6.cpp
DreadMaks Dec 24, 2021
ced4369
Create 7.cpp
DreadMaks Dec 24, 2021
fc58c8c
Create 1.cpp
DreadMaks Dec 24, 2021
27e0a4f
Create 2.cpp
DreadMaks Dec 24, 2021
d8acfa5
Create 3.cpp
DreadMaks Dec 24, 2021
3fba170
Create 4.cpp
DreadMaks Dec 24, 2021
1b726da
Create 5.cpp
DreadMaks Dec 24, 2021
7168ff1
Create 04.12.21.cpp
DreadMaks Dec 24, 2021
86c6575
Update and rename 04.12.21.cpp to 18.12.21.cpp
DreadMaks Dec 24, 2021
6562e66
Create 04.12.21.cpp
DreadMaks Dec 24, 2021
03af2dd
Create 1.cpp
DreadMaks Dec 24, 2021
0c8db2a
Create 2.cpp
DreadMaks Dec 24, 2021
d9be049
Create 3.cpp
DreadMaks Dec 24, 2021
4c5b6e3
Create 4.cpp
DreadMaks Dec 24, 2021
548c98f
Create 5.1.cpp
DreadMaks Dec 24, 2021
23bdd27
Create 5.2.cpp
DreadMaks Dec 24, 2021
00587fc
Create 1.cpp
DreadMaks Dec 24, 2021
aa9965e
Create 1.1.cpp
DreadMaks Dec 25, 2021
a204dfd
Create 1.2.cpp
DreadMaks Dec 25, 2021
e086c3e
Create 2.cpp
DreadMaks Dec 25, 2021
ba87800
Create 3.cpp
DreadMaks Dec 25, 2021
96d9a8d
Create 4.cpp
DreadMaks Dec 25, 2021
6c35dfe
Create 1.cpp
DreadMaks Dec 26, 2021
5ba2d51
Create 2.cpp
DreadMaks Dec 26, 2021
9087823
Create 3.cpp
DreadMaks Dec 26, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
87 changes: 87 additions & 0 deletions 04.12.21.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
// Эту работу мы делали 4 декабря в субботу на паре
#include <iostream>
#include <string>
using namespace std;
class Car
{
string brand;
string model;
int year;


public:

static int k;

Car(){
brand = "nisan";
model = "n";
year = 1989;
k++;
}

// Car(string b, string m, int y):brand(b),model(m),year(y){}

Car(string brand, string model, int year){
this->brand = brand;
this->model = model;
this-> setYear(year);
k ++;
}

string getBrand(){
return brand;
}
void setBrand(string b){
brand = b;
}
void setModel(string m){
model = m;
}
void setYear(int y){
if((y >= 1980) && (y <= 2021)){
year = y;
}else {
year = 666;
}
}

void info(){
cout << "Brand: " << brand <<endl;
cout << "Model: " << model <<endl;
cout << "Year: " << year <<endl;
}
};

int Car::k = 0;

main()
{
Car firstCar;
Car thirdCar("audi", "X5", 1999);
// firstCar.setBrand("audi");
// firstCar.getBrand();
// firstCar.setModel("X5");
// firstCar.setYear(1999);
//firstCar.brand = "BMV";
//firstCar.model = "X5";
//firstCar.year = 2010;
Car secondCar;
secondCar.setBrand("volvo");
secondCar.setModel("no");
secondCar.setYear(99);
//secondCar.brand = "opel";
//secondCar.model = "no";
//secondCar.year = 2015;

firstCar.info();
secondCar.info();
thirdCar.info();

cout << firstCar.k <<endl; // firstCar - это экземпляр класса
cout << secondCar.k <<endl;
cout << thirdCar.k <<endl;
cout << Car::k <<endl;

return 0;
}
70 changes: 70 additions & 0 deletions 18.12.21.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
// Эту работу мы делали 18 декабря в субботу на паре
// полиморфизм, инкапсуляция, наследование, абстакция
#include <iostream>
#include <string>

using namespace std;

class Animal
{
protected:
string name;
string colour;
int age;
public:
virtual void Show() = 0;
string getName(){
return name;
}
virtual string Speak() = 0;

//Animal(string n, int a):name(n), age(a) {}

Animal(string name, string colour, int age){
this->name = name;
this->colour = colour;
this->age = age;
}
};

class Cat:public Animal // мы получаем доступ только к публичному
{
string poroda;

public:
Cat(string name, string colour, int age, string poroda):Animal(name, colour, age){
this->poroda = poroda;
}

void Show() override {
cout << name << " " << colour << " " << age <<" ";
cout << poroda <<endl;
}

string Speak() override {
return "meow";
}
};

int main()
{
string name;
string colour;
string poroda;
int age;
cin >> name;
cin >> colour;
cin >> age;
//cin >> poroda;

/*Animal FirstAnimal("enot", "white", 4);
FirstAnimal.Show();*/

cout <<endl;

Cat firstCat(name, colour, age, "poroda");
firstCat.Show();
cout << firstCat.Speak();

return 0;
}
23 changes: 23 additions & 0 deletions Task 2/1.1.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#include <iostream>
#include <cmath>
using namespace std;

float Vector(int x, int y, int z)
{
return sqrt(x * x + y * y + z * z);
}

int main()
{
setlocale(LC_ALL, "Russian");

int x = 1;
int y = 5;
int z = 3;

float length = Vector(x, y, z);

cout << " Длина вектора = " << length << endl;

return 0;
}
27 changes: 27 additions & 0 deletions Task 2/1.2.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#include <iostream>
#include <cmath>
using namespace std;

float Vector(int x, int y, int z)
{
return sqrt(x * x + y * y + z * z);
}
void Vector(int x, int y, int z, float length)
{
cout << " Eдиничный вектор длины = " << x / length << " " << y / length << " " << z / length << endl;

}
int main()
{
setlocale(LC_ALL, "Russian");

int x = 1;
int y = 5;
int z = 3;

float length = Vector(x, y, z);

Vector(x, y, z, length);

return 0;
}
30 changes: 30 additions & 0 deletions Task 2/1.3.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#include <iostream>
#include <cmath>

using namespace std;

float Scalar(int x, int a, int y, int b, int z, int c)
{
return x*a + y*b + z*c;
}

int main()
{
setlocale(LC_ALL, "Russian");

int x = 1;
int y = 5;
int z = 3;
int a;
int b;
int c;

cout <<"Вычислите скалярное произведение векторов "<<endl;

cout <<"Введите переменные ";
cin >>a>>b>>c;

cout <<"Скалярное произведение = "<< Scalar(x, a, y, b, z, c)<<endl;

return 0;
}
28 changes: 28 additions & 0 deletions Task 2/1.4.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#include <iostream>
#include <cmath>
using namespace std;

void Vector(int x,int a,int y,int b,int z,int c)
{
cout<<" Произведение векторов = "<<y*c - z*b<<"; "<<-1*(x*c - z*a)<<"; "<<x*b - y*a<< "; " << endl;
}

int main()
{
setlocale(LC_ALL, "Russian");

int x = 1;
int y = 5;
int z = 3;
int a;
int b;
int c;

cout <<"Векторное произведение векторов"<<endl;
cout << "Введите переменные ";
cin >> a >> b >> c;
Vector(x, y, z, a, b, c);


return 0;
}
44 changes: 44 additions & 0 deletions Task 2/2.1.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#include <cstdlib>
#include <iostream>
#include <math.h>

// Взято с сайта : https://www.cyberforum.ru/cpp-beginners/thread1368338.html


float perimetr(float x, float y, float z)//получает длины оснований и высоту
{
float p;
p = x + y + 2 * sqrt(((x - y) / 2) * ((x - y) / 2) + z * z);//суммирует два основания и по теореме пифагора находит боковую поверхность ,тк их две то умножаем на 2
return p;
}

float ploschad(float x, float y, float z)//получает длины оснований и высоту
{
float s;
s = z * ((x + y) / 2);//формула площади трапеции ,полусумма оснований умноженная на высоту
return s;
}
int main()
{
setlocale(LC_ALL, "rus");
float a1, b1, h1, p1, s1, a2, b2, h2, p2, s2;

printf("Введите два основания и высоту первой трапеции: ");
scanf_s("%f %f %f", &a1, &b1, &h1);
printf("Введите два основания и высоту второй трапеции: ");
scanf_s("%f %f %f", &a2, &b2, &h2);

p1 = perimetr(a1, b1, h1);
p2 = perimetr(a2, b2, h2);

printf("Сумма периметров = %f \n", p1 + p2);

s1 = ploschad(a1, b1, h1);
s2 = ploschad(a2, b2, h2);

printf("Сумма площадей = %f \n", s1 + s2);


system("PAUSE");
return EXIT_SUCCESS;
}
26 changes: 26 additions & 0 deletions Task 2/2.2.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#include <iostream>
#include <cmath>

using namespace std;

void circle(int, int R, double PI)
{
cout << "Периметр круга = " << 2 * PI * R << endl;

cout << "Площадь груга = " << PI * R * R << endl;
}

int main()

{
setlocale(LC_ALL, "RUSSIAN");

int R;
const double PI = 3.141592653589793;

cout << "Введите переменную для круга: ";

cin >> R;

circle(2, R, PI);
}
22 changes: 22 additions & 0 deletions Task 2/2.3.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#include <iostream>

using namespace std;

int main()
{
setlocale(LC_ALL, "RUSSIAN");

int side, area, perimeter;

cout << "Сторона квадрата: ";
cin >> side;


area = side * side;
perimeter = (side + side) * 2;

cout << "Площадь квадрата: " << area << endl;
cout << "Периметр квадрата: " << perimeter << endl;

return 0;
}
Loading