I was writing a small program for my sister in 2nd grade. The program itself is quite silly but it's only for my sister, so well, it is silly.
I wanna ask her to enter "1" if see loves me, and "0" if not. And what I like to add to the function is that if see enter nothing in thirteen given seconds, I like the choice to be automatically "1". How would I write this...?
Code:
#include <stdio.h>
#include <stdlib.h>
#include <windows.h>
void func(void) {
printf(".....3\a\n");
Sleep(1000);
printf(".....2\a\n");
Sleep(1000);
printf(".....1\a\n");
Sleep(1000);
system("cls");
printf("I love you, Radu!!!\n\a");
Sleep(2000);
for(;;) {
printf("So much!\a");
}
}
main() {
int choice;
printf("Maria, do you love your brother...?\n");
printf("If you love him, push \"1\". If you don't, push \"0\". \n>");
scanf("%d", &choice);
Sleep(10000);
/*I want to automatically input "1" if see does not enter withing Sleep(10000)*/
/*But how?*/
func();
if(choice == '0') {
printf("Oh wwwwwwwhhhhhhhhhyyyyyyyyyyy!\n\a\a\a");
} else if(choice == '1') {
func();
}
return 0;
}