Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <math.h>
- int main()
- {
- double x1, y1, x2, y2, x3, y3;
- scanf_s("%lf%lf%lf%lf%lf%lf\n", &x1, &y1, &x2, &y2, &x3, &y3);
- double a, b, c;
- a = sqrt((abs(pow(x1 - x2,2))) + (abs(pow(y1 - y2,2))));
- b = sqrt((abs(pow(x1 - x3, 2))) + (abs(pow(y1 - y3, 2))));
- c = sqrt((abs(pow(x2 - x3, 2))) + (abs(pow(y2 - y3, 2))));
- double perimeter = a + b + c;
- double area = 1 / 2 * abs(x1*y2 - x2 * y1 - x3 * y2 + x2 * y3 + x3 * y1 - x1 * y3);
- char command;
- scanf_s("%c", &command);
- switch (command)
- {
- case 'u': printf("Umfang = %lf", perimeter); break;
- case 's': printf("Flaeche = %lf", area); break;
- default: printf("Ungueltig!");
- break;
- }
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement