little C code

SGT.Code

Active Member
Reputation
0
this is a little newbie game you can code in C
i did not code this on my own i learnt it off a website add translated it from french.

you will need a program like code::blocks:
http://adf.ly/45lf

its just a simple game of guess the number

Code:
#include<stdio.h>
#include<stdlib.h>
#include<time.h>

int main (int argc, char ** argv)
{
  int mysterieNumber = 0 , numberEntered = 0;
  const int MAX = 100 , MIN = 1;

  srand (time (NULL));
  mysterieNumber = (srand) % (MAX - MIN + 1 )) +MIN;

  do
{
  printf ("what is the mysrterieNumber?");
  scanf ("%d", numberEntered);

  if (mysterieNumber > numberEntered)
   printf ("it's more!"\n\n");
  else if (mysterieNumber < numberEntered)
   printf ("its less"\n\n);
  else
   printf ("well done you have found the mystery number!"\n\n)
  }while (numberEntered != mysteryNumber);

}
 
Well this is cool. Im going to have to learn how to do this sometime.
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…