Update 'cv3/program.c'

This commit is contained in:
Tamáš 2024-03-08 08:40:36 +00:00
parent 72c07053cd
commit 9cee0d1287

View File

@ -20,14 +20,13 @@ int main() {
int count = 0; int count = 0;
printf("Enter the value of x: ");
fgets(buffer, BUFFER_SIZE, stdin); fgets(buffer, BUFFER_SIZE, stdin);
if (sscanf(buffer, "%lf", &x) != 1) { if (sscanf(buffer, "%lf", &x) != 1) {
printf("Nepodarilo sa nacitat zaklad x\n"); printf("Nepodarilo sa nacitat zaklad x\n");
return 0; return 0;
} }
printf("Enter coefficients from highest to lowest degree, finish with an empty line:\n");
while (fgets(buffer, BUFFER_SIZE, stdin) && buffer[0] != '\n') { while (fgets(buffer, BUFFER_SIZE, stdin) && buffer[0] != '\n') {
if (sscanf(buffer, "%lf", &coef) == 1) { if (sscanf(buffer, "%lf", &coef) == 1) {
coefficients[count++] = coef; coefficients[count++] = coef;
@ -46,3 +45,4 @@ int main() {
return 0; return 0;
} }