daco dzive12

This commit is contained in:
Denis Landa 2025-03-14 10:57:42 +01:00
parent 2cc4118ecf
commit 992f03332e

View File

@ -6,28 +6,23 @@
int main(){ int main(){
char riadok[100]; char riadok[100];
while(fgets(riadok, sizeof(riadok), stdin)){
if(riadok[0] == '\n'){
printf("KONIEC\n");
break;
}
char *ptr = riadok; char *ptr = riadok;
while(*ptr == ' ')ptr++; while(*ptr == ' ')ptr++;
float cislo1 = strtof(ptr, &ptr); float cislo1 = strtof(ptr, &ptr);
while(*ptr == ' ')ptr++; while(*ptr == ' ')ptr++;
char operacia = *ptr; char operacia = *ptr;
ptr++; ptr++;
while(*ptr == ' ')ptr++; while(*ptr == ' ')ptr++;
float cislo2 = strtof(ptr, &ptr); float cislo2 = strtof(ptr, &ptr);
while(*ptr == ' ')ptr++; while(*ptr == ' ')ptr++;
if (*ptr != '='){ if (*ptr != '='){
printf("CHYBA\n"); printf("CHYBA\n");
continue; continue;
} }
ptr++; ptr++;