Hello Everyone,
This is my first post so sorry if it's bad.
Here is my code:
Code:
#include <stdio.h>#include <unistd.h>
int main()
{
int age;
printf( "How old are you?" );
scanf( "%d", &age );
if ( age < 80 ) {
printf( "Many years of learning ahead\n\n");
}
else {
printf( "May the force be with you\n\n");
}
system("PAUSE\n\n");
printf("Lets play a game.\n\n");
printf("You have %d seconds to cancel your computer from being shutdown.\n", age);
printf("Good luck.\n\n");
do
{
printf("%d\n",age);
sleep(1);
age-=1;
} while(age>=0);
system("pause");
return 0;
}
Obviously the computer isn't going to be shutdown(it's to scare my brother) but every time I try to compile it, it says undefined reference to 'sleep'.
So what I want to happen is that it countsdown every second from their age.
Any help is appreciated. Thank you.