Date: Sun, 6 Jul 1997 21:39:35 -0400 (EDT) From: Jude DaShiell Sender: jdashiel AT eagle1 DOT eaglenet DOT com To: James Edwin Cooper Cc: djgpp AT delorie DOT com Subject: Re: Why won't it change?!? In-Reply-To: <5pnu89$6tr$1@missing.link.ca> Message-Id: Mime-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Precedence: bulk You need to have a loop in the code to make the program repeat. After you tell user what their letter choice was, c=""; will clear the original letter out and your loop needs to start above your message. I'll offer a suggestion here. In the msdos/c subdirectory on the simtelnet mirrors you'll find a file called cguidexx.zip where xx is a number. If you download that file and read it you'll get alot of help on C. > Here is a sample program I made: > main() > { > char letter; > printf("please type a letter: "); > getche(letter); > printf("\nYour letter was "%c, letter); > } > > I think that is what it is, probably a couple mistakes. > Anyway, I fixed the code,etc. and got it to compile and work but only the > first time I use it does it work right. Here is an example: > > PASS 1: please type a letter: e > Your letter was e > PASS 2: please type a letter: s > Your letter was e > PASS 3: please type a letter: b > Your letter was e > > Any reason WHY? Same thing happens with random number generators. Also, I > tried a timing exercise and here is what happened: > PASS 1: Time:4.57676736(whatever) seconds. > PASS 2: Time:4.57676736 seconds. > > Another time: > PASS 1: Time:2.54 (???) seconds. > PASS 2: Time:0 seconds. > > If you can explain ANY of these odd occurances It would be appreciated. > P.S. I got these STRAIGHT from a book (with minor changes for DJGPP) so > their is NO mistakes in what I compiled! Just weird output on the second > run. First run is correct but the next ones don't work properly! Thanks! > //eoj jude Microsoft asks me where I want to go today but UNIX gets me there.