Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int a, b,c, p, xa,xb,ya,yb,xc,yc;
- int POLE_TROJKATA(int a, int b){
- p=a*b/2;
- return p;
- }
- int POLE_TROJKATA(int xa, int xb, int ya,int yb,int xc, int yc){
- p = (xb-xa)*(yc-ya)-(yb-ya)*(xc-xa)/2;
- return p;
- }
- int main()
- {
- cout << "1 - 2 liczby " << endl;
- cout << "2 - wspolrzedne " << endl;
- cin >> c;
- if(c==1){
- cout << "Podaj 2 liczby: " << endl;
- cin >> a;
- cin >> b;
- cout << POLE_TROJKATA(a, b) << endl;
- }
- else if(c==2){
- cout << "Podaj współrzędne(x1,y1,x2,y2,x3,y3): " << endl;
- cin >> xa>>ya>>xb>>yb>>xc>>yc;
- cout << POLE_TROJKATA(xa, xb, ya, yb, xc, yc);
- }
- else{
- }
- cout << POLE_TROJKATA(a, b) << endl;
- return 0;
- }
Add Comment
Please, Sign In to add comment