Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- int x1, x2, x3, x4, y1, y2, y3, y4;
- cout << "Iveskite keturkampio tasku koordinates: \n";
- cout << "Tasko A koordinatės: "; cin >> x1 >> y1;
- cout << "Tasko B koordinatės: "; cin >> x2 >> y2;
- cout << "Tasko C koordinatės: "; cin >> x3 >> y3;
- cout << "Tasko D koordinatės: "; cin >> x4 >> y4;
- if (x1 <= 0 ){
- x1 = x1 * -1;
- }
- if (x2 <= 0){
- x2 = x2 * -1;
- }
- if (x3 <= 0){
- x3 = x3 * -1;
- }
- if (x4 <= 0){
- x4 = x4 * -1;
- }
- if (y1 <= 0 ){
- y1 = y1 * -1;
- }
- if (y2 <= 0){
- y2 = y2 * -1;
- }
- if (y3 <= 0){
- y3 = y3 * -1;
- }
- if (y4 <= 0){
- y4 = y4 * -1;
- }
- ilgisB(x1, x2);
- ilgisC(x1, x3);
- cout << "Jusu ivesto staciakampio plotas yra lygus: " << plotas(AB, AC);
- cout << "Jusu ivesto staciakampio perimetras yra lygus: " << perimetras(AB, AC);
- return;
- }
- int ilgisB(int x1,int x2){
- int AB;
- AB = x1 + x2;
- return AB;
- }
- int ilgisC(int x1, int x3){
- int AC;
- AC = x1 + x3;
- return AC;
- }
- int plotas(int x,int y){
- int s = 0;
- s = (x * y ) / 2;
- return s;
- }
- int perimetras(int x,int y){
- int p = 0;
- p = ( x + y ) * 2;
- return p;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement