-
Notifications
You must be signed in to change notification settings - Fork 26
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
Kochneva darina #82
Open
CuteDarKy
wants to merge
24
commits into
Nastasia8:Kochneva_Darina
Choose a base branch
from
CuteDarKy:Kochneva_Darina
base: Kochneva_Darina
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Kochneva darina #82
Changes from all commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
55aa824
Add files via upload
CuteDarKy eeda2f7
Add files via upload
CuteDarKy 7705e7a
Add files via upload
CuteDarKy bc5e709
Add files via upload
CuteDarKy f6ee85a
Update 9.11_Task3.cpp
CuteDarKy 09301ff
Add files via upload
CuteDarKy a92eb9b
Add files via upload
CuteDarKy ff8e174
Add files via upload
CuteDarKy a07bfbd
Add files via upload
CuteDarKy 1f91147
Add files via upload
CuteDarKy 0de801e
Add files via upload
CuteDarKy d8c757e
Add files via upload
CuteDarKy 59c750b
Add files via upload
CuteDarKy df85e20
Add files via upload
CuteDarKy 0866917
5* 1 задание подробно прокомментированное
CuteDarKy ed334b7
5* 2 задание подробно прокомментированное
CuteDarKy b6e98a7
исправила тип переменной result
CuteDarKy 8923e18
Update 18.12_Task1.cpp
CuteDarKy e6a0073
Update 18.12_Task1.cpp
CuteDarKy 939411c
Update 23.10_Task7.cpp
CuteDarKy 38cf2c5
Update 23.10_Task8.cpp
CuteDarKy 0f50c4e
Delete 13.11_Task1.cpp
CuteDarKy d2dbfc4
Delete 13.11_Task2.cpp
CuteDarKy 1698716
Лабораторна 5* с комментариями
CuteDarKy File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
#include <iostream> | ||
#include <cmath> | ||
#include <string> | ||
#include <windows.h> | ||
|
||
using namespace std; | ||
|
||
class Student{ | ||
private: | ||
string FIO; | ||
int year; | ||
int group; | ||
int age; | ||
string checkFIO(string FIO){ //проверка верности ввода данных | ||
if(FIO == ""){ | ||
cout<<"Name isn't correct. Enter the name: "; | ||
cin>>FIO; | ||
} | ||
return FIO; | ||
} | ||
int checkYear(int year){ //проверка верности ввода данных | ||
if((year<1)||(year>4)){ | ||
cout<<"Course isn't correct. Enter the course: "; | ||
cin>>year; | ||
} | ||
return year; | ||
} | ||
int checkGroup(int group){ //проверка верности ввода данных | ||
if(group == 0){ | ||
cout<<"Group isn't correct. Enter the group: "; | ||
cin>>group; | ||
} | ||
return group; | ||
} | ||
int checkAge(int age){ //проверка верности ввода данных | ||
if((age<17)||(age>60)){ | ||
cout<<"Age isn't correct. Enter the age: "; | ||
cin>>age; | ||
} | ||
return age; | ||
} | ||
public: | ||
void show(); | ||
void input(string FIO, int year,int group,int age); | ||
}; | ||
void Student::show(){ | ||
cout << "FIO: " << FIO << "\nYear: " << year << "\nGroup: " << group << "\nAge: " << age << endl; //вывод данных студентов на экран | ||
} | ||
void Student::input(string FIO, int year,int group,int age){ | ||
this->FIO = checkFIO(FIO); | ||
this->year = checkYear(year); | ||
this->group = checkGroup(group); | ||
this->age = checkAge(age); | ||
} | ||
|
||
int main(){ | ||
SetConsoleOutputCP(1251); | ||
Student First; | ||
Student Second; | ||
Student Third; | ||
First.input("Kochneva Darina Alexseevna", 1, 42, 18); | ||
Second.input("Bykov Peter Olegovich", 3, 185, 21); | ||
Third.input("Ivanov Ivan Ivanovich", 4, 42, 24); | ||
First.show(); | ||
Second.show(); | ||
Third.show(); | ||
|
||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
#include <iostream> | ||
#include <cmath> | ||
#include <fstream> | ||
#include <string> | ||
#include <windows.h> | ||
|
||
using namespace std; | ||
class Employee{ | ||
private: | ||
string FIO; | ||
int years; | ||
string position; | ||
string homeAdd; | ||
string number; | ||
int hours; | ||
int PriseOfWorkHour; | ||
string checkString(string s){ //проверка верности ввода данных | ||
if(s == ""){ | ||
cout<<"It isn't correct. Enter again: "; | ||
cin>>s; | ||
} | ||
return s; | ||
} | ||
int checkInt(int i){ //проверка верности ввода данных | ||
if(i==0){ | ||
cout<<"It isn't correct. Enter again: "; | ||
cin>>i; | ||
} | ||
return i; | ||
} | ||
public: | ||
Employee(string FIO, int years, string position, string homeAdd, string number, int hours, int PriseOfWorkHour){ //присваивание проверенных данных | ||
this->FIO = checkString(FIO); | ||
this->years = checkInt(years); | ||
this->position =checkString(position); | ||
this->homeAdd = checkString(homeAdd); | ||
this->number = checkString(number); | ||
this->hours = checkInt(hours); | ||
this->PriseOfWorkHour = checkInt(PriseOfWorkHour); | ||
} | ||
void salary(){ //метод расчёта зарплаты | ||
cout << "Salary of this employee: " << hours * PriseOfWorkHour << endl; | ||
} | ||
void premium(){ //метод расчёта премии | ||
if ((years >= 1) && (years < 3)) { | ||
cout << "Premium of this employee: " << (hours * PriseOfWorkHour * 3)/100 << endl; | ||
} else if ((years >= 3) && (years < 6)) { | ||
cout << "Premium of this employee: " << (hours * PriseOfWorkHour * 5)/100 << endl; | ||
} else if ((years >= 6) && (years <= 9)) { | ||
cout << "Premium of this employee: " << (hours * PriseOfWorkHour * 7)/100 << endl; | ||
} else if (years >= 10) { | ||
cout << "Premium of this employee: " << (hours * PriseOfWorkHour * 13)/100 << endl; | ||
} | ||
} | ||
void showInfo(){ //вывод информации о сотруднике на экран | ||
cout << "FIO: " << FIO << endl; | ||
cout << "Experience: " << years << endl; | ||
cout << "Position: " << position << endl; | ||
cout << "Home adress: " << homeAdd << endl; | ||
cout << "Number: " << number << endl; | ||
cout << "Hours: " << hours << endl; | ||
cout << "The cost of one hour of work: " << PriseOfWorkHour << endl; | ||
cout << endl; | ||
} | ||
void record(){ //метод вывода данных в файл | ||
ofstream file(FIO + ".txt"); | ||
file << "FIO: " << FIO << endl; | ||
file << "Experience: " << years << endl; | ||
file << "Position: " << position << endl; | ||
file << "Home adress: " << homeAdd << endl; | ||
file << "Number: " << number << endl; | ||
file << "Hours: " << hours << endl; | ||
file << "The cost of one hour of work: " << PriseOfWorkHour << endl; | ||
file.close(); | ||
} | ||
}; | ||
|
||
int main() | ||
{ | ||
Employee First("Xina John Bro", 1, "Delevoper", "Ivanovo, Shubinyh 32", "+71231231312", 100, 500); | ||
Employee Second("", 0, "", "", "", 0, 0); | ||
First.showInfo(); | ||
Second.showInfo(); | ||
First.salary(); | ||
Second.salary(); | ||
First.premium(); | ||
Second.premium(); | ||
First.record(); | ||
Second.record(); | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,176 @@ | ||
//Код взят у Бутусова Александра | ||
#include <iostream> | ||
#include <ctime> | ||
|
||
using namespace std; | ||
|
||
class Massive { | ||
public: | ||
int rows; | ||
int columns; | ||
int **Giga; //двумерный динамический массив | ||
int **TrGiga; //транспонированная матрица (динамическая) | ||
int **DopGiga; //дополнительный массив (двумерный динамический) | ||
//a | ||
Massive(int r, int c){ | ||
rows = r; | ||
columns = c; | ||
Giga = new int* [rows]; //создаём динамический массив | ||
for (int i = 0; i <rows; i++){ | ||
Giga[i] = new int[columns]; | ||
} | ||
for (int i = 0; i < rows; i++){ //заполняем случайными числами | ||
for (int j = 0; j < columns; j++){ | ||
Giga[i][j] = rand() % 201 + (-100); | ||
} | ||
} | ||
} | ||
//b | ||
~Massive(){ | ||
for (int i = 0; i < rows; i++){ //очищаем ячейки массива | ||
delete[] Giga[i]; | ||
} | ||
delete Giga; //удаляем двумерный массив | ||
for (int i = 0; i < columns; i++){ //очищаем ячейки транспонированнай матрицы | ||
delete[] TrGiga[i]; | ||
} | ||
delete TrGiga; //удаляем транспонированную матрицу | ||
for (int i = 0; i < rows; i++){ //очищаем ячейки дополнительного двумерного массива | ||
delete[] DopGiga[i]; | ||
} | ||
delete DopGiga; //удаляем дополнительный массив | ||
|
||
} | ||
//c | ||
void showInfo(){ //вывод двумерного массива на экран | ||
for (int i = 0; i < rows; i++){ | ||
for (int j = 0; j < columns; j++){ | ||
cout << Giga[i][j] << " "; | ||
} | ||
cout << endl; | ||
} | ||
cout << endl; | ||
} | ||
//d | ||
void transport(){ //транспонируем матрицу | ||
TrGiga = new int * [columns]; | ||
for (int i = 0; i < columns; i++){ | ||
TrGiga[i] = new int[rows]; | ||
} | ||
for (int i = 0; i < rows; i++){ | ||
for (int j = 0; j < columns; j++){ | ||
TrGiga[i][j] = Giga[j][i]; | ||
cout << TrGiga[i][j] << " "; | ||
} | ||
cout << endl; | ||
} | ||
cout << endl; | ||
} | ||
//f | ||
void zero(){ | ||
for (int i = 0; i < rows; i++){ | ||
for (int j = 0; j < columns; j++){ | ||
if (Giga[i][j] < 0){ //заменяем отрицательные значения нулями | ||
Giga[i][j] = 0; | ||
} | ||
} | ||
} | ||
} | ||
//e | ||
void sumMatrix(){ | ||
DopGiga = new int * [rows]; //создаём матрицу | ||
for (int i = 0; i < rows; i++){ | ||
DopGiga[i] = new int[columns]; | ||
} | ||
for (int i = 0; i < rows; i++){ //задаём значения ячеек матрицы | ||
for (int j = 0; j < columns; j++){ | ||
DopGiga[i][j] = rand() % 201 + (-100); | ||
cout << DopGiga[i][j] << " "; //выводим матрицу на экран | ||
} | ||
cout << endl; | ||
} | ||
cout << endl; | ||
for (int i = 0; i < rows; i++){ | ||
for (int j = 0; j < columns; j++){ | ||
DopGiga[i][j] = DopGiga[i][j] + Giga[i][j]; //находим сумму двух матриц | ||
cout << DopGiga[i][j] << " "; //выводим на экран | ||
} | ||
cout << endl; | ||
} | ||
} | ||
}; | ||
|
||
int main(){ | ||
srand(time(NULL)); | ||
Massive First(3,3); //берём вкачестве примера массив 3х3 | ||
Massive Second (4, 4); //берём вкачестве примера массив 4х4 | ||
Massive Third (2, 2); //берём вкачестве примера массив 2х2 | ||
First.showInfo(); | ||
Second.showInfo(); | ||
Second.zero(); | ||
Second.showInfo(); | ||
First.transport(); | ||
Third.showInfo(); | ||
Third.sumMatrix(); | ||
|
||
|
||
//1 | ||
cout << "Array of odd elements in each row of the array = { "; | ||
int *sumNechet = new int[First.rows]; | ||
for (int i = 0; i < First.rows; i++){ | ||
int t = 1; | ||
int sum = 0; | ||
for (int j = 0; j < First.columns; j++){ | ||
if(t % 2 != 0){ //находим нечётные числа в массиве | ||
sum += First.Giga[i][j]; //складываем нечётные числа в каждой строке массива | ||
} | ||
t++; | ||
} | ||
sumNechet[i] = sum; //вводим результат в одномерный массив по строкам | ||
} | ||
for (int i =0; i < First.rows; i++){ | ||
cout << sumNechet[i] << " "; //выводим одномерный массив с ответом | ||
} | ||
cout << "}" << endl; | ||
|
||
//2 | ||
cout << "Array of maximum elements in each column among the odd values = { "; | ||
int *maxStolbNechet = new int[First.columns]; | ||
for (int i = 0; i < First.columns; i++){ | ||
int max = -1000; | ||
for (int j = 0; j < First.rows; j++){ | ||
if((First.Giga[j][i] % 2 != 0) && First.Giga[j][i] > max){ //находим максимум среди нечётных чисел столбцов массива | ||
max = First.Giga[j][i]; //запоминаем максимум из столбца | ||
} | ||
} | ||
maxStolbNechet[i] = max; //записываем максимумы столбцов в одномерный массив | ||
} | ||
for (int i =0; i < First.columns; i++){ | ||
if (maxStolbNechet[i] != -1000){ //проверяем наличие максимума | ||
cout << maxStolbNechet[i] << " "; //выводим массив максимумов | ||
} else { | ||
cout << "Nothing! "; //если максимумы не найдены | ||
} | ||
} | ||
cout << "}" << endl; | ||
|
||
//3 | ||
cout << "Array of average value in each column = { "; | ||
float *sredStolb = new float[First.columns]; //создаём одномрный массив | ||
for (int i = 0; i < First.columns; i++){ | ||
int sred = 0; | ||
for (int j = 0; j < First.rows; j++){ | ||
sred += First.Giga[j][i]; //складываем числа столбца | ||
} | ||
sredStolb[i] = sred/First.columns; //находим среднее столбца | ||
} | ||
for (int i =0; i < First.columns; i++){ | ||
cout << sredStolb[i] << " "; //выводим массив средних значений по столбцам | ||
} | ||
cout << "}" << endl; | ||
|
||
delete sredStolb; //удаляем массив | ||
delete sumNechet; //удаляем массив | ||
delete maxStolbNechet; //удаляем массив | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#include <iostream> | ||
#include <cmath> | ||
|
||
using namespace std; | ||
|
||
double modul(int x, int y, int z){ | ||
double m=(pow((pow(x,2)+pow(y,2)+pow(z,2)), 1/2)); | ||
return m; | ||
} | ||
|
||
int main(){ | ||
int x=1, y=5, z=3, leigth=0; | ||
leigth=modul(x, y, z); | ||
cout<<"1. Leigth of vector = "<<leigth<<endl; | ||
int b; | ||
b=(x/leigth)+(y/leigth)+(z/leigth); | ||
cout<<"2. b = "<<b<<endl; | ||
int x1, y1, z1, scalar; | ||
cout<<"x = "; cin>>x1; | ||
cout<<"y = "; cin>>y1; | ||
cout<<"z = "; cin>>z1; | ||
scalar=x*x1+y*y1+z*z1; | ||
cout<<"3. Scalarnoe proizvedenie = "<<scalar<<endl; | ||
double vector, i, j, k; | ||
i=(y*z1-z*y1); | ||
j=-(x*z1-z*x1); | ||
k=(x*y1-y*x1); | ||
vector=modul(i,j,k); | ||
cout<<"4. Vectornoe proizvedenie = "<<vector<<endl; | ||
return 0; | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
мне он скоро снится будет)