Лабораторная работа №4

Run Settings
LanguageC++
Language Version
Run Command
#include <iostream> using namespace std; void task61 () { cout<<"#61\n"; double x, y; cin >> x >> y; x /= 3.6; if (x > y) cout << "Первая быстрее\n" << endl; else if (x < y) cout << "Вторая быстрее\n" << endl; else cout << "Скорости равны\n" << endl; } void task72 () { cout<<"#72\n"; char a,b,c; cin >> a >> b >> c; if(a>c) cout << "Первое больше последнего\n" << endl; if(a<c) cout << "Пследнее больше первого\n" << endl; if(a==c) cout << "Числа равны\n" << endl; } void task83() { cout<<"#83\n"; int x, y; cin >> x >> y; cout <<"Точка А расположена "; if (x==0 && y==0) cout <<"в начале координат\n"; else if (x==0) cout <<" на оси Y\n"; else if (y==0) cout <<" на оси X\n"; else if (x>0 && y>0) cout <<" в 1 четверти\n"; else if (x<0 && y>0) cout <<" во 2 четверти\n"; else if (x<0 && y<0) cout <<" в 3 четверти\n"; else cout <<" в 4 четверти\n" << endl; } void task94() { cout<<"#94\n"; int x; cin >> x; if (x/2) cout <<"Не любит\n"; else cout <<"Любит\n" << endl; } void task105() { cout<<"#105\n"; int a, b, c, d; cin >> a >> b >> c >> d; if(a+b<=c||a+c<=b||b+c<=a||a+b<=d||a+d<=b||b+d<=a||d+b<=c||d+c<=b||b+c<=d||a+d<=c||a+c<=d||d+c<=a) cout <<"треугольники построить нельзя\n"<<endl; else cout <<"треугольники построить можно\n"<<endl; } void task116() { cout<<"#116\n"; double a, b, c, s, p; cin >> a >> b >> c; if(a+b<=c||a+c<=b||b+c<=a) cout <<"треугольник построить нельзя\n"<<endl; else { cout <<"треугольник построить можно\n"<<endl; p=(a+b+c)/2; s=(p*(p-a)*(p-b)*(p-c)); cout<<"s="<< s <<endl; } } void task127() { cout<<"#127\n"; long a, b, c; cin >> a >> b >> c; if(a+b>32767) cout <<"Переполнено\n"; else { cout <<"Ответ:"<<endl; c=a+b; cout<<"с="<< c <<endl; } } void task138() { cout<<"#138\n"; int a, b, c; cin >> a >> b >> c; if(a==b || a==c || b==c) cout <<"Равные числа присутствуют\n"; else cout <<"Равные числа отсутствуют\n" <<endl; } void task149() { cout<<"\n#149\n"; int a, b, c, d, e, f; cin >> a >> b >> c >> d >> e >> f; if (a+b+c==d+e+f) cout <<"Число счастливое\n"; else cout <<"Число не счастливое\n" <<endl; } void task160() { cout<<"#160\n"; int a,b,c; if(a+b<=c||a+c<=b||b+c<=a) { if(a*a < b*b+c*c||b*b < a*a+c*c||c*c < a*a+b*b) cout << "Существует, остроугольный\n"; else cout << "Существует, не остроугольный\n"; } else cout << "Не существует\n" << endl;; } int main() { task61(); task72(); task83(); task94(); task105(); task116(); task127(); task138(); task149(); task160(); }
Editor Settings
Theme
Key bindings
Full width
Lines