rendered paste body// File : Deitel_?
// Tuna Ilgaz
/* Purpose : */
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
// Contasts
// ============================== MAIN ===================================
int random(int orj);
int random(int orj)
{
int orjx;
orjx = 1 + ( rand() % 100 );
return orjx;
}
int main(void)
{
int sayi;
int orj;
orj = random(orj);
printf ("I have a number between 1 and 100\n");
printf ("Can you guess my number?\n");
printf ("Please type your first guess.\n");
while ( sayi != -1 )
{
printf ("Sayi:%d\n",random(orj));
printf ("Number(-1 to end): ");
scanf ("%d",&sayi);
if ( sayi == -1 )
{
break;
}
if ( orj == sayi )
{
printf ("Excellent! You guessed the number!\n");
orj = 0;
orj = 1 + ( rand() % 100 );
break;
}
if ( sayi < orj )
{
printf ("Too low. Try again.\n");
}
if ( sayi > orj )
{
printf ("Too high. Try again.\n");
}
}
system ("PAUSE");
return (0);
}
// =============================== END ===================================