Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <math.h>
- using namespace std;
- void func1(double a, double b, double c);
- void func2(double a, double b, double c, double d);
- void func3(char c, double x);
- void func4(double x1, double y1, double x2, double y2);
- void func1(double a, double b, double c){
- if (b >= c && b <= a){
- a *= 2;
- b *= 2;
- c *= 2;
- }
- else{
- a = fabs(a);
- b = fabs(b);
- c = fabs(c);
- }
- }
- void func2(double a, double b, double c, double d){
- double t;
- if (a>b){
- t = a;
- a = b;
- b = t;
- }
- if (c>d){
- t = c;
- c = d;
- d = t;
- }
- if (a<c && b<d)
- cout << "YES" << endl;
- else
- cout << "NO" << endl;
- }
- void func3(char c, double x){
- switch (c){
- case 'k':
- cout << "S=" << x*x / 2 << endl << "g=" << sqrt(x*x + x*x) << endl;
- break;
- case 'g':
- cout << "S=" << x*x / 4 << endl << "k=" << sqrt(x*x / 2) << endl;
- break;
- case 's':
- cout << "k=" << sqrt(2 * x) << endl << "g=" << sqrt(2 * x*x) << endl;
- break;
- default:
- break;
- }
- }
- void func4(double x1, double y1, double x2, double y2){
- if (sqrt(x1*x1 + y1*y1)<sqrt(x2*x2 + y2*y2))
- cout << 'A' << endl;
- else
- cout << 'B' << endl;
- }
- int main(){
- double a, b, c, d;
- char s;
- cout << "1)Vvedite a, b, c:" << endl;
- cin >> a >> b >> c;
- func1(a, b, c);
- cout << a << ' ' << b << ' ' << c << endl;
- cout << "2)Vvedite a, b, c, d:" << endl;
- cin >> a >> b >> c >> d;
- func2(a, b, c, d);
- cout << "3)Vyberete: k - katet, g - gipotenuza s - ploschad'" << endl << "Vvedite velichinu x:" << endl;
- cin >> s >> a;
- func3(s, a);
- cout << "4)Vvedite x1, y1, x2, y2:" << endl;
- cin >> a >> b >> c >> d;
- func4(a, b, c, d);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement