Mail Archives: djgpp/1997/07/06/21:44:34
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 <jdashiel AT eagle1 DOT eaglenet DOT com>
Microsoft asks me where I want to go today but UNIX gets me there.
- Raw text -