Commit c2360412 by tonis2

update

parent 3ea936e1
No preview for this file type
......@@ -3,6 +3,12 @@
#define SUMMA 100
int is_correct_choice(char user_answer[3]) {
char new[3];
strcpy(new, user_answer);
return (strcmp(new, "no") == 0) || (strcmp(new, "yes") == 0);
}
int main(void)
{
......@@ -11,10 +17,20 @@ int main(void)
printf("Kas soovite väikseid kupüüre? ( yes / no ) \n");
scanf("%s", user_answer);
while (!strcmp(user_answer, "no") == 0 || !strcmp(user_answer, "yes") == 0) {
printf("Kas soovite väikseid kupüüre? ( yes / no ) \n");
scanf("%s", user_answer);
int user_choice = is_correct_choice(user_answer);
printf("Vastus %d \n", user_choice);
// while (*is_correct_choice != 1) {
// printf("Kas soovite väikseid kupüüre? ( yes / no ) \n");
// scanf("%s", user_answer);
// user_choice = is_correct_choice(user_answer);
// }
if (is_correct_choice == 0) {
printf("Vastus %s \n", is_correct_choice);
}
// printf("Vastus %s \n", user_answer);
return 0;
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment