Advertisement
aurimas12

Untitled

Jun 18th, 2019
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.33 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main()
  5. {
  6.     int x1, x2, x3, x4, y1, y2, y3, y4;
  7.     cout << "Iveskite keturkampio tasku koordinates: \n";
  8.     cout << "Tasko A koordinatės: "; cin >> x1 >> y1;
  9.     cout << "Tasko B koordinatės: "; cin >> x2 >> y2;
  10.     cout << "Tasko C koordinatės: "; cin >> x3 >> y3;
  11.     cout << "Tasko D koordinatės: "; cin >> x4 >> y4;
  12.  
  13.  
  14.  
  15.     if (x1 <= 0 ){
  16.         x1 = x1 * -1;
  17.     }
  18.  
  19.     if (x2 <= 0){
  20.         x2 = x2 * -1;
  21.     }
  22.  
  23.     if (x3 <= 0){
  24.         x3 = x3 * -1;
  25.     }
  26.  
  27.     if (x4 <= 0){
  28.         x4 = x4 * -1;
  29.     }
  30.  
  31.     if (y1 <= 0 ){
  32.         y1 = y1 * -1;
  33.     }
  34.  
  35.     if (y2 <= 0){
  36.         y2 = y2 * -1;
  37.     }
  38.  
  39.     if (y3 <= 0){
  40.         y3 = y3 * -1;
  41.     }
  42.  
  43.     if (y4 <= 0){
  44.         y4 = y4 * -1;
  45.     }
  46.  
  47.     ilgisB(x1, x2);
  48.     ilgisC(x1, x3);
  49.     cout << "Jusu ivesto staciakampio plotas yra lygus: " << plotas(AB, AC);
  50.     cout << "Jusu ivesto staciakampio perimetras yra lygus: " << perimetras(AB, AC);
  51.  
  52.     return;
  53. }
  54.  
  55. int ilgisB(int x1,int x2){
  56.     int AB;
  57.     AB = x1 + x2;
  58.     return AB;
  59. }
  60.  
  61. int ilgisC(int x1, int x3){
  62.     int AC;
  63.     AC = x1 + x3;
  64.     return AC;
  65. }
  66.  
  67. int plotas(int x,int y){
  68.     int s = 0;
  69.     s = (x * y ) / 2;
  70.     return s;
  71. }
  72.  
  73. int perimetras(int x,int y){
  74.     int p = 0;
  75.     p = ( x + y ) * 2;
  76.     return p;
  77. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement