/*
We using Dev C++ v 6.0 to make the source codes
Author : Nurul Huda
e-mail : h2d4890@gmail.com
*/
/*using Random and randomize*/
#include "stdio.h"
#include "conio.h"
#include "stdlib.h"
#include "time.h"
/*this function just for palying with programing using C
this program implement random and randomize to make a number
from 0 until 100 and the user must found the number*/
void main()
{
int e;
do{system("cls");
int a,b;
srand((unsigned) time(0));
a=rand()%100;
//printf("\n %d\n",a); //if you want to win. active this function
do{
fflush(stdin);
printf("Insert Number= ");
scanf("%d",&b);
if(b>a)
{
printf("Less\n"); /*the number is too big*/
}
else if (a>b) {printf("More\n");} /*the number is to small*/
else {printf("ok\n");} /*found the number*/
}
while(a!=b);
printf("Congratulation!\n");
printf("Try Again (1=yes) ");
scanf("%d",&e);
}
while(e==1);
}
Categories:
C programming


Langganan:
Posting Komentar (Atom)
0 Response for the "Random and Randomize"
Posting Komentar