|
Description
This example gets a
random number in a range then depending
on the number chosen a saying is displayed.
Code
#include <stdio.h>
#include <time.h>
#include <stdlib.h>
void main()
{
int randno;
srand((unsigned)time(NULL));
randno = rand() % 3 + 1;
switch(randno)
{
case 1 :
printf("There will come a day
when all the work is finished or when
it is too late to finish it\n");
break;
case 2 :
printf("You get nothing for free
\n");
break;
case 3 :
printf("The world goes to shit
when I dont do this first \n");
break;
case 4 :
printf("You get nothing for free
\n");
break;
default :
printf("Ill be amazed if this
displays\n");
break;
}
}
Information
tested in Visual C++
6
|