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

Minihomework2 (Паникарский Иван) #183

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
12 changes: 12 additions & 0 deletions sem1/Panikarsky Ivan/minihomework1/Task1.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#include <iostream>
using namespace std;

int main()
{
setlocale(LC_ALL, "Rus");
int SizeSquar, SquareArea;
cout << "Введите длину стороны квадрата:";
cin >> SizeSquar;
SquareArea = SizeSquar * SizeSquar;
cout << "Площадь Вашего квадрата:" << SquareArea;
}
17 changes: 17 additions & 0 deletions sem1/Panikarsky Ivan/minihomework1/Task2.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#include<iostream>
using namespace std;

int main()
{
setlocale(LC_ALL, "Rus");
float UpperSideTrapezoid, LowerSideTrapezoid, TrapezoidHeight, HalfSumBases, TrapezoidArea;
cout << "Введите длину верхнего основания Вашей трапеции:";
cin >> UpperSideTrapezoid;
cout << "Введите длину нижнего основания Вашей трапеции:";
cin >> LowerSideTrapezoid;
cout << "Введите высоту Вашей трапеции:";
cin >> TrapezoidHeight;
HalfSumBases = (UpperSideTrapezoid + LowerSideTrapezoid) / 2;
TrapezoidArea = HalfSumBases * TrapezoidHeight;
cout << "Площадь Вашей трапеции:" << TrapezoidArea;
}
36 changes: 36 additions & 0 deletions sem1/Panikarsky Ivan/minihomework1/Task3.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#include <iostream>
using namespace std;

int main()
{
setlocale(LC_ALL, "rus");
int N, Nmax, Cnt, digitsFIB, digitsFIB_bag, digitsFIB_result;
bool Check;
digitsFIB = 0;
digitsFIB_bag = 0;
digitsFIB_result = 0;
cout << "\t\t\t\tВведите количество чисел Фибоначчи, которые Вы хотите узнать:";
cin >> Nmax;
cout << "\n\n";
N = Nmax;
Cnt = 0;
Check = ((N == Nmax) == 1);

switch (Check)
{
case 1:
cout << Cnt++ << " Число Фибоначчи: " << digitsFIB << "\n\n";
N--;
digitsFIB++;

case 0:
for (int i = 1; N != 0; N--)
{
digitsFIB_result = digitsFIB + digitsFIB_bag;
cout << Cnt++ << " Число Фибоначчи: " << digitsFIB_result << "\n\n";
digitsFIB = digitsFIB_bag;
digitsFIB_bag = digitsFIB_result;
}
break;
}
}
66 changes: 66 additions & 0 deletions sem1/Panikarsky Ivan/minihomework1/Task4.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
#include<iostream>
using namespace std;

int main()
{
setlocale(LC_ALL, "ru");
int number, digit, number_bag, cnt, number_bag1;
cout << "Введите Ваше число:";
cin >> number;
cout << "\n";
cnt = 0;
number_bag = number;
for (; number > 0; )
{
number /= 10;
cnt++;
}
cout << "Ваше число в обратном порядке:";
for (; cnt > 0; cnt--)
{
switch (number_bag % 10)
{
case 0:
cout << "0";
number_bag /= 10;
break;
case 1:
cout << "1";
number_bag /= 10;
break;
case 2:
cout << "2";
number_bag /= 10;
break;
case 3:
cout << "3";
number_bag /= 10;
break;
case 4:
cout << "4";
number_bag /= 10;
break;
case 5:
cout << "5";
number_bag /= 10;
break;
case 6:
cout << "6";
number_bag /= 10;
break;
case 7:
cout << "7";
number_bag /= 10;
break;
case 8:
cout << "8";
number_bag /= 10;
break;
case 9:
cout << "9";
number_bag /= 10;
break;
}
}
cout << "\n";
}
36 changes: 36 additions & 0 deletions sem1/Panikarsky Ivan/minihomework2/Task2.1.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#include <iostream>

using namespace std;


int main()
{
while (1)
{
int digit, Menu;
setlocale(LC_ALL, "ru");
cout << "\t\t\t\t\tВыберете действие:" << endl;
cout << "Что бы перевести из Десятичной СС в Восмеричную, нажмите 1" << endl;
cout << "Что бы перевести из Десятичной СС в Шестнадцатиричную, нажмите 2" << endl;
cout << "Что бы завершить работу, нажмите 0" << endl;
cin >> Menu;
switch (Menu)
{
case 1:
cout << "Введите число в десятичной системе, которое нужно преобразовать в Восмиричную:";
cin >> digit;
cout << "Получившийся результат:\t" << oct << digit << endl;
cout << "==================================================" << endl;
break;
case 2:
cout << "Введите число в десятичной системе, которое нужно преобразовать в Шестнадцатиричную:";
cin >> digit;
cout << "Получившийся результат:\t" << hex << digit << endl;
cout << "==================================================" << endl;
break;
case 0:
cout << "==================================================" << endl;
return 0;
}
}
}
28 changes: 28 additions & 0 deletions sem1/Panikarsky Ivan/minihomework2/Task2.2.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#include <iostream>
using namespace std;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

опачке! С этой строкой не принимаю !


int main()
{
setlocale(LC_ALL, "ru");
int digit;
cout << "Введите любое число:";
cin >> digit;
cout << "Гипотеза гласит, что независимо от выбора числа рано или поздно мы получим 1" << endl;
cout << "==========================================" << endl;
while (digit != 1)
{
if (digit % 2 == 0)
{
digit /= 2;
}
else
{
digit *= 3;
++digit;
digit /= 2;

}
}
cout << "Гипотеза верна, мы получили:\t" << digit;
return 0;
}