2023-12-04 15:24:40 +01:00
|
|
|
#include <stdio.h>
|
|
|
|
|
|
|
|
#include <math.h>
|
2023-12-04 15:56:21 +01:00
|
|
|
#include "main_rovnice.h"
|
2023-12-04 15:24:40 +01:00
|
|
|
|
|
|
|
int trojuholnikalgo(int a, int b, int c) {
|
|
|
|
if (((a + b) > c) && ((a + c) > b) && ((b + c) > a)) {
|
|
|
|
printf("Trojuholník sa dá zostrojiť");
|
|
|
|
return 1;
|
|
|
|
} else {
|
|
|
|
printf("Trojuholník sa nedá zostrojiť");
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void trojuholniktyp(int a, int b, int c) {
|
|
|
|
//rovnostranny
|
|
|
|
if (a == b && a == c) {
|
|
|
|
printf(" a je rovnostranný\n");
|
|
|
|
}
|
|
|
|
//rovnoramenny
|
|
|
|
else if (a == b || a == c || b == c) {
|
|
|
|
printf(" a je rovnoramenný");
|
|
|
|
}
|
|
|
|
//pravouhly
|
2024-01-22 14:41:15 +01:00
|
|
|
else if ((pow(a, 2) + pow(a, 2)) == pow(c, 2) || (pow(b, 2) + pow(c, 2)) == pow(a, 2) ||
|
|
|
|
(pow(a, 2) + pow(c, 2)) == pow(b, 2)) {
|
2023-12-04 15:24:40 +01:00
|
|
|
printf(" a je pravouhlý");
|
|
|
|
}
|
|
|
|
//nic z toho
|
|
|
|
else {
|
|
|
|
printf(" a je rôznostranný");
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
void trojuholnik() {
|
|
|
|
int a = 0;
|
|
|
|
int b = 0;
|
|
|
|
int c = 0;
|
|
|
|
|
|
|
|
printf("Zadaj číslo:");
|
2024-01-22 14:41:15 +01:00
|
|
|
scanf("%d", &a);
|
2023-12-04 15:24:40 +01:00
|
|
|
printf("Zadaj číslo:");
|
2024-01-22 14:41:15 +01:00
|
|
|
scanf("%d", &b);
|
2023-12-04 15:24:40 +01:00
|
|
|
printf("Zadaj číslo:");
|
2024-01-22 14:41:15 +01:00
|
|
|
scanf("%d", &c);
|
2023-12-04 15:24:40 +01:00
|
|
|
if (trojuholnikalgo(a, b, c) == 1) {
|
|
|
|
trojuholniktyp(a, b, c);
|
|
|
|
}
|
|
|
|
printf("\n");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
void rovnicapriamky() {
|
|
|
|
int a = 0;
|
|
|
|
int b = 0;
|
|
|
|
int x = 0;
|
|
|
|
int y = 0;
|
|
|
|
|
|
|
|
printf("Zadaj A:");
|
2024-01-22 14:41:15 +01:00
|
|
|
scanf("%d", &a);
|
2023-12-04 15:24:40 +01:00
|
|
|
printf("Zadaj B:");
|
2024-01-22 14:41:15 +01:00
|
|
|
scanf("%d", &b);
|
2023-12-04 15:24:40 +01:00
|
|
|
|
|
|
|
printf("Rovnica priamky je y = %d * x + %d\n", a, b);
|
|
|
|
|
|
|
|
printf("Zadaj súradnicu bodu x:");
|
2024-01-22 14:41:15 +01:00
|
|
|
scanf("%d", &x);
|
2023-12-04 15:24:40 +01:00
|
|
|
printf("Zadaj súradnicu bodu y:");
|
2024-01-22 14:41:15 +01:00
|
|
|
scanf("%d", &y);
|
2023-12-04 15:24:40 +01:00
|
|
|
|
|
|
|
if (((a * x) + b) == y) {
|
|
|
|
printf("Bod [%d; %d] leží na priamke y = %d * x + %d.\n", x, y, a, b);
|
|
|
|
} else {
|
|
|
|
printf("Bod [%d; %d] neleží na priamke y = %d * x + %d.\n", x, y, a, b);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-12-04 15:56:21 +01:00
|
|
|
int rovnice() {
|
2023-12-04 15:24:40 +01:00
|
|
|
|
|
|
|
//trojuholnik();
|
|
|
|
rovnicapriamky();
|
|
|
|
return 0;
|
|
|
|
}
|