Advertisement
pan7nikt

zad_3_1

Oct 16th, 2023
551
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.14 KB | None | 0 0
  1. #define _USE_MATH_DEFINES
  2. #include <iostream>
  3. #include <cmath>
  4.  
  5. using namespace std;
  6.  
  7. char type = ' ';
  8.  
  9. int main()
  10. {
  11.     cout << "P, K czy T???: ";
  12.     cin >> type;
  13.  
  14.     if(type=='p'||type=='P')
  15.         {
  16.             int a = 0;
  17.             int b = 0;
  18.             int w = 0;
  19.             cout << "podaj bok a: ";
  20.             cin >> a;
  21.             cout << "podaj bok b: ";
  22.             cin >> b;
  23.             w = a*b;
  24.             cout << "Pole prostokata wynosi: " << w;
  25.         }
  26.     else if(type=='t'||type=='T')
  27.         {
  28.             int a = 0;
  29.             int h = 0;
  30.             int w = 0;
  31.             cout << "podaj podstawe: ";
  32.             cin >> a;
  33.             cout << "podaj wysokosc: ";
  34.             cin >> h;
  35.             w = (a*h)/2;
  36.             cout << "Pole trojkata wynosi: " << w;
  37.         }
  38.     else if(type=='k'||type=='K')
  39.         {
  40.             int r = 0;
  41.             int w = 0;
  42.             cout << "podaj promien: ";
  43.             cin >> r;
  44.             w = pow(r,2)*M_PI;
  45.             cout << "Pole kola wynosi: " << w;
  46.         }
  47.     else
  48.         {
  49.             cout << "Podano nieprawidlowy znak";
  50.         }
  51. }
  52.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement