www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/01/31/22:40:43

From: "Wendy Eubank" <scotteubank AT worldnet DOT att DOT net>
Newsgroups: comp.os.msdos.djgpp
Subject: Whats Wrong with this code PLEASE HELP!!
Date: 1 Feb 1999 03:36:44 GMT
Organization: AT&T WorldNet Services
Lines: 53
Message-ID: <7937gc$k81@bgtnsc01.worldnet.att.net>
NNTP-Posting-Host: 12.78.131.61
X-Newsreader: Microsoft Outlook Express 4.71.1712.3
X-MimeOLE: Produced By Microsoft MimeOLE V4.71.1712.3
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

I am learning C..  Could you please review this code and tell me whats
wrong.

I am using  "rhide "

ON COMPILE  the following error is generated
----------------------------------------------------------------------------
---------------------------
in function main:
../../../djgpp/projects/rndtest.c(13) Error: void not ignored as it ought to
be
There were some errors.
----------------------------------------------------------------------------
-----------------------------
What the ????

 Here's the CODE
----------------------------------------------------------------------------
-
#include <stdio.h>
#include <stdlib.h>

main(){
     short seed,rndnum,guess,cntr;
/* 1.  Ask User for a Number
   2.  Create a Random Number From it
   3.  Give User 10 Tries to Guess the Number.
*/
   printf("Enter a Seed Number for the Random # Generator !\n");
   scanf("%i",&seed);

   rndnum = srand(seed);

   do{
      printf("Guess the Number?/n");
      scanf("%i",&guess);

        if(guess==rndnum){
          printf("You Guessed Correct!/n");
          cntr=11;
          }

      cntr++;

      }while (cntr<=10);
   return 0;
}
----------------------------------------------------------------------------
---

Thanks Ahead of time...


- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019