Aktualizovat du5/program.c

This commit is contained in:
Tomáš Vlček 2026-04-14 21:39:39 +00:00
parent ce24dc5c40
commit 9e1eb53d6a

View File

@ -13,7 +13,7 @@ int main()
char question[SIZE]; char question[SIZE];
char question2[SIZE]; char question2[SIZE];
char answer = '0'; //'0' = ako keby 'NULL'/ absencia hodnoty char answer = '0'; //'0' = ako keby 'NULL'/ absencia hodnoty
int readLineNumber = 1; bool isFirstQuestionRead = false;
bool isFirstOptionLoaded = false; bool isFirstOptionLoaded = false;
bool err = false; bool err = false;
@ -43,16 +43,16 @@ int main()
answer = line[0]; answer = line[0];
break; break;
} }
else if (readLineNumber == 1) else if (!isFirstQuestionRead)
{ {
sscanf(line, "%127[^\n]]", question); sscanf(line, "%127[^\n]]", question);
isFirstQuestionRead = true;
// strcat(question, "?"); // strcat(question, "?");
} }
else else
{ {
sscanf(line, "%127[^\n]]", question2); sscanf(line, "%127[^\n]]", question2);
} }
readLineNumber += 1;
} }
if (answer == '0') { err = true; } if (answer == '0') { err = true; }