A89: Re: C problem...
[Prev][Next][Index][Thread]
A89: Re: C problem...
have you tried forcing the initial high score initials to be in place? like
set up a default initials of abc and see if they display correctly. Then
you can see if the problem is in your displaying, your storage, or your
entering in.
--kaus
----- Original Message -----
From: <JHill8075@aol.com>
To: <assembly-89@lists.ticalc.org>
Sent: Saturday, May 27, 2000 9:49 PM
Subject: A89: C problem...
>
> I'm gaving a problem with my C program (problamatic code is below). I'm
> working on the highscore and I decided to allow the user to put his/her
> initials in. The program displays the initials while the user is typing
them
> in, but then when you play it the second time it's supposed to show you
who
> has the highscore and what their initials are, but it only displays their
> first initial. I consulted another C programmer for the 89 ,and we
> re-arranged and re-wrote the code in different ways (including changing it
> from a char variable to an int variable which it is now), but the bug(?)
is
> still there. Can anyone figure this out? Thanks a lot.
>
> Josh
> <A HREF="http://pa.ticalc.org">Programmers Anonymous</A> Member
>
> void end(int score,int *highscore,int *initials)
> {
>
> int count,key=0,x=0;
> clrscr();
> printf("Game Over");
> printf("\nYour score is %d.",score);
> if(score<=*highscore)
> printf("\nHighscore is %d by %c",*highscore,*initials);
>
> if(score>*highscore)
> {
> printf("\nOld High Score was %d",*highscore);
> *highscore=score;
> printf("\nNew High Score of %d!",score);
>
> printf("\nEnter your initials.\n");
> for(count=0;count<=2;count++)
> {
> GKeyFlush();
> while(key==0)
> {
> key=getchar();
> ST_busy(ST_IDLE);
> }
> *initials=key;
>
> initials++;
> key=0;
> }
> }
> GKeyFlush();
> GKeyIn(NULL,0);
> clrscr();
> return;
> }
> file://...more code here...
> file://in _main
> static int initials[3]={0,0,0,NULL};
> file://...rest of program
>
References: