test
This commit is contained in:
parent
3637255a09
commit
1f1de1a061
@ -8,11 +8,12 @@ int main() {
|
|||||||
char uloha[MAX_LINE_LENGTH];
|
char uloha[MAX_LINE_LENGTH];
|
||||||
|
|
||||||
while (fgets(uloha, MAX_LINE_LENGTH, stdin) != NULL) {
|
while (fgets(uloha, MAX_LINE_LENGTH, stdin) != NULL) {
|
||||||
|
|
||||||
int cislo1, cislo2, vysledok_zadany;
|
int cislo1, cislo2, vysledok_zadany;
|
||||||
char operacia;
|
char operacia;
|
||||||
|
|
||||||
|
|
||||||
|
while (getchar() != '\n');
|
||||||
|
|
||||||
if (sscanf(uloha, "%d %c %d = %d", &cislo1, &operacia, &cislo2, &vysledok_zadany) != 4) {
|
if (sscanf(uloha, "%d %c %d = %d", &cislo1, &operacia, &cislo2, &vysledok_zadany) != 4) {
|
||||||
printf("CHYBA\n");
|
printf("CHYBA\n");
|
||||||
continue;
|
continue;
|
||||||
@ -20,7 +21,6 @@ int main() {
|
|||||||
|
|
||||||
double vysledok_skutocny;
|
double vysledok_skutocny;
|
||||||
|
|
||||||
|
|
||||||
switch (operacia) {
|
switch (operacia) {
|
||||||
case '+':
|
case '+':
|
||||||
vysledok_skutocny = cislo1 + cislo2;
|
vysledok_skutocny = cislo1 + cislo2;
|
||||||
|
Loading…
Reference in New Issue
Block a user