Skip to content

Instantly share code, notes, and snippets.

@Adefful
Created July 11, 2019 10:09
Show Gist options
  • Save Adefful/4a7bda2633a6df20fb65f7ad7a283ddd to your computer and use it in GitHub Desktop.
Save Adefful/4a7bda2633a6df20fb65f7ad7a283ddd to your computer and use it in GitHub Desktop.
#include <iostream>
#include <math.h>
#define P 3.14
using namespace std;
int main() {
int a = 0, b = 0, c = 0, d = 0, r = 0, d1 = 0, p1 = 0, s1 = 0, p2 = 0, s2 = 0, s3 = 0, s4 = 0, g = 0, h = 0, k = 0;
double p = 0, s = 0;
cout << " menu \n";
cout << "select"" to number: \n";
cout << "1-colculation perimeter \n";
cout << "2-colculation area \n";
cout << "3-calculation of the possibility of the existence of a triangle \n";
cin >> h;
if (h < 1)
{
cout << "incomprehensible query, enter again";
cin >> h;
}
if (h > 3)
{
cout << "incomprehensible query, enter again";
cin >> h;
}
switch (h)
{
case 1:
cout << "you chose 1-perimeter \n";
cout << "now you need to choose which shape you need to find the perimeter \n";
cout << "---------------------------------------- \n";
cout << "1-colculation perimeter quadrilateral \n";
cout << "2-colculation perimeter circle \n";
cout << "3-colculation perimeter triangle \n";
cin >> k;
if (k < 1)
{
cout << "incomprehensible query, enter again \n";
cin >> k;
}
if (k > 3)
{
cout << "incomprehensible query, enter again \n";
cin >> k;
}
switch (k)
{
case 1:
cout << "you chose 1-quadrelateral \n\n";
cout << "now enter lenght a \n";
cin >> a;
cout << "enter width b \n";
cin >> b;
p2 = (a * 2) + (b * 2);
cout << "perimeter quadrelateral = " << p2;
break;
case 2:
cout << "you chose 2-circle \n\n";
cout << "now enter radius \n";
cin >> r;
p = 2 * P * r;
cout << "perimeter circle = " << p;
break;
case 3:
cout << "you chose 3-triangle \n\n";
cout << "now enter 1 side \n";
cin >> a;
cout << "enter 2 side \n";
cin >> b;
cout << "enter 3 side \n";
cin >> c;
p2 = a + b + c;
cout << "perimeter triangle = " << p2;
break;
}
break;
case 2:
cout << "you chose 2-area \n";
cout << "now you need to choose which shape you need to find the area \n";
cout << "---------------------------------------- \n";
cout << " 1-colculation area quadrilateral \n";
cout << " 2-colculation area circle \n";
cout << " 3-colculation area triangle \n";
cin >> d;
if (d < 0)
{
cout << "incomprehensible query, enter again \n";
cin >> d;
}
if (d > 3)
{
cout << "incomprehensible query, enter again \n";
cin >> d;
}
case 3:
cout << "you chose 2-possibility of existence \n";
cout << "-------------------------------- \n";
cout << "now enter 1 side \n";
cin >> a;
cout << "enter 2 side \n";
cin >> b;
cout << "enter 3 side \n";
cin >> c;
if((a < b+c) and (b < a+c) and (c < a+b))
{
cout << "the triangle exists";
}
else
{
cout << "the triangle doesnt exists";
}
}
switch (d)
{
case 1:
cout << "you chose 1-quadrilateral \n";
cout << "select to number: \n";
cout << "1-colculation area square \n";
cout << "2-colxulation area rectengle \n";
cin >> g;
if (g < 1)
{
cout << "incomprehensible query, enter again";
cin >> g;
}
if (g > 2)
{
cout << "incomprehensible query, enter again";
cin >> g;
}
switch (g)
{
case 0:
cout << "you chose 0-square \n";
cout << "enter 1 side \n";
cin >> a;
s = a * a;
cout << "area square = " << s;
break;
case 1:
cout << "you chose 1-rectengle \n";
cout << "enter lenght a \n";
cin >> a;
cout << "enter width b \n";
cin >> b;
s = a * b;
cout << "area rectangle = " << s;
break;
}
case 2:
cout << "you chose 2 \n";
cout << "enter radius R \n";
cin >> r;
s = P * r * r;
cout << "area circle = " << s;
break;
case 3:
cout << "you chose 4 \n";
cout << "enter 1 side \n";
cin >> a;
cout << "enter 2 side \n";
cin >> b;
cout << "enter 3 side \n";
cin >> c;
p2 = a + b + c;
p = (double)p2 / 2;
s = sqrt(p * (p - a) * (p - b) * (p - c));
cout << "area triangle = " << s;
break;
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment