Mail Archives: djgpp/2000/01/18/17:22:55
From: | "Jason" <manman AT netteens DOT net>
|
Newsgroups: | comp.os.msdos.djgpp
|
Subject: | Urgent ! Please help!!!
|
Date: | Tue, 18 Jan 2000 14:41:35 +0800
|
Organization: | netteens.net (Hongkong Telecom IMS)
|
Lines: | 238
|
Message-ID: | <861210$4tj$1@imsp026.netvigator.com>
|
NNTP-Posting-Host: | olkc10a202.netvigator.com
|
Mime-Version: | 1.0
|
X-Priority: | 3
|
X-MSMail-Priority: | Normal
|
X-Newsreader: | Microsoft Outlook Express 5.50.3825.400
|
X-MimeOLE: | Produced By Microsoft MimeOLE V5.50.3825.400
|
To: | djgpp AT delorie DOT com
|
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp
|
Reply-To: | djgpp AT delorie DOT com
|
This is a multi-part message in MIME format.
------=_NextPart_000_000A_01BF61C2.1E6D6A20
Content-Type: text/plain;
charset="big5"
Content-Transfer-Encoding: quoted-printable
Hi everybody! Can anyone tells me what's wrong if I change my porg from =
version 1 to version 2?
(note: NUM_LPAYERS=3D2)
Version 1:
void get_name(char Player1[], char Player2[], PLAYER player_array[], int =
curplays[])
{
char P1[5]; =20
char P2[5]; =20
char sp[] =3D " "; =20
char a;
int level;
clrscr();
list_players(player_array); =20
printf("\n\n Please choose who is to play as player 1 (choose 1 thru =
%d) :", NUM_PLAYERS);
gets(P1);
while ((P1[0]<'1') || (P1[0]>NUM_PLAYERS+'0')) =20
{
printf("%c is invalid, please rechoose: ",P1[0]);
gets(P1);
}
/*changes starts here*/
printf("\n\n Please choose who is to play as player 2 (choose 1 thru =
%d, except %c) :", NUM_PLAYERS, P1[0]);
gets(P2);
while (((P2[0]<'1') || (P2[0]>NUM_PLAYERS+'0')) || (P2[0]=3D=3DP1[0])) =
=20
{
printf("%c is invalid, please rechoose: ",P2[0]);
gets(P2);
}
/*changes ends here*/
curplays[0]=3D (int) (P1[0] - '1'); =20
curplays[1]=3D (int) (P2[0] - '1'); =20
strcpy(Player1, player_array[(int) (P1[0] - '1')].first); =20
strcat(Player1, sp);
strcat(Player1, player_array[(int) (P1[0] - '1')].last);
strcpy(Player2, player_array[(int) (P2[0] - '1')].first); =20
strcat(Player2, sp);
strcat(Player2, player_array[(int) (P2[0] - '1')].last); =20
return;
}
Version 2:
void get_name(char Player1[], char Player2[], PLAYER player_array[], int =
curplays[])
{
char P1[5];=20
char P2[5]; =20
char sp[] =3D " "; =20
clrscr();
list_players(player_array); =20
printf("\n\n Please choose who is to play as player 1 (choose 1 thru =
%d) :", NUM_PLAYERS);
gets(P1);
while ((P1[0]<'1') || (P1[0]>NUM_PLAYERS+'0')) =20
{
printf("%c is invalid, please rechoose: ",P1[0]);
gets(P1);
}
/*changes starts here*/ =20
if (P1[0]=3D=3D'1')
P2[0]=3D'0';
else if (P1[0]=3D=3D'0')
P2[0]=3D1;
/*changes ends here*/
=20
curplays[0]=3D (int) (P1[0] - '1'); =20
curplays[1]=3D (int) (P2[0] - '1'); =20
strcpy(Player1, player_array[(int) (P1[0] - '1')].first); =20
strcat(Player1, sp);
strcat(Player1, player_array[(int) (P1[0] - '1')].last);
strcpy(Player2, player_array[(int) (P2[0] - '1')].first); =20
strcat(Player2, sp);
strcat(Player2, player_array[(int) (P2[0] - '1')].last); =20
return;
}
------=_NextPart_000_000A_01BF61C2.1E6D6A20
Content-Type: text/html;
charset="big5"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; charset=3Dbig5">
<META content=3D"MSHTML 5.50.3825.1300" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>Hi everybody! Can anyone tells me =
what's wrong if I=20
change my porg from version 1 to version 2?</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>(note: NUM_LPAYERS=3D2)</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>Version 1:</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>void get_name(char Player1[], char =
Player2[],=20
PLAYER player_array[], int curplays[])<BR>{<BR> char=20
P1[5]; &=
nbsp; &n=
bsp; </DIV></F=
ONT>
<DIV><FONT face=3DArial size=3D2> char=20
P2[5]; &=
nbsp; &n=
bsp; <BR> =
;char=20
sp[] =3D "=20
";  =
; =
</FONT></DIV>
<DIV><FONT face=3DArial size=3D2> char a;<BR> int=20
level;<BR> clrscr();<BR> =20
list_players(player_array); &nbs=
p; =20
</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT><FONT face=3DArial =
size=3D2> </DIV></FONT>
<DIV><FONT face=3DArial size=3D2> printf("\n\n Please choose who is =
to play as=20
player 1 (choose 1 thru %d) :", =
NUM_PLAYERS);<BR> gets(P1);<BR> while=20
((P1[0]<'1') ||=20
(P1[0]>NUM_PLAYERS+'0')) &nbs=
p; <BR> =20
{<BR> printf("%c is invalid, please rechoose:=20
",P1[0]);<BR> gets(P1);<BR> }</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial color=3D#ff0000 size=3D2>/*changes starts =
here*/</FONT></DIV>
<DIV><FONT face=3DArial size=3D2> printf("\n\n Please choose who is =
to play as=20
player 2 (choose 1 thru %d, except %c) :", NUM_PLAYERS,=20
P1[0]);<BR> gets(P2);<BR> while (((P2[0]<'1') ||=20
(P2[0]>NUM_PLAYERS+'0')) || =
(P2[0]=3D=3DP1[0])) </FONT></DIV>
<DIV><FONT face=3DArial size=3D2> {<BR> =
printf("%c is=20
invalid, please rechoose: =
",P2[0]);<BR> gets(P2);<BR> =20
}</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>
<DIV><FONT face=3DArial color=3D#ff0000 size=3D2>/*changes ends=20
here*/</FONT></DIV></FONT></DIV>
<DIV><FONT face=3DArial size=3D2><BR> curplays[0]=3D (int) (P1[0] - =
'1'); &n=
bsp; &nb=
sp; <BR> curplays[1]=3D=20
(int) (P2[0] -=20
'1'); &n=
bsp; &nb=
sp; <BR> =20
strcpy(Player1, player_array[(int) (P1[0] -=20
'1')].first); <BR> strcat(Player1,=20
sp);<BR> strcat(Player1, player_array[(int) (P1[0] -=20
'1')].last);<BR> strcpy(Player2, player_array[(int) (P2[0] - =
'1')].first); <BR> strcat(Player2,=20
sp);<BR> strcat(Player2, player_array[(int) (P2[0] -=20
'1')].last); </FONT></DIV>
<DIV><FONT face=3DArial size=3D2>return;<BR>}<BR></FONT></DIV>
<DIV><FONT face=3DArial size=3D2>Version 2:</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>void get_name(char Player1[], char =
Player2[],=20
PLAYER player_array[], int curplays[])<BR>{<BR> char=20
P1[5]; </FONT></DIV>
<DIV><FONT face=3DArial size=3D2> char=20
P2[5]; &=
nbsp; &n=
bsp; <BR> =
;char=20
sp[] =3D "=20
";  =
; =
<BR> clrscr();<BR> =20
list_players(player_array); &nbs=
p; =20
</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2> printf("\n\n Please choose who is =
to play as=20
player 1 (choose 1 thru %d) :", =
NUM_PLAYERS);<BR> gets(P1);<BR> while=20
((P1[0]<'1') ||=20
(P1[0]>NUM_PLAYERS+'0')) &nbs=
p;<BR> =20
{<BR> printf("%c is invalid, please rechoose:=20
",P1[0]);<BR> gets(P1);<BR> }<BR>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT color=3D#ff0000><FONT face=3DArial size=3D2>/*changes starts=20
here*/</FONT> </FONT><BR> if =
(P1[0]=3D=3D'1')<BR> =20
P2[0]=3D'0';<BR> else if (P1[0]=3D=3D'0')<BR> =
P2[0]=3D1;</DIV>
<DIV><FONT face=3DArial color=3D#ff0000 size=3D2>/*changes ends=20
here*/</FONT></DIV> <BR> curplays[0]=3D (int) =
(P1[0] -=20
'1'); &n=
bsp; &nb=
sp; </FONT></DIV>
<DIV><FONT face=3DArial size=3D2> curplays[1]=3D (int) (P2[0] -=20
'1'); &n=
bsp; &nb=
sp; <BR> =20
strcpy(Player1, player_array[(int) (P1[0] -=20
'1')].first); <BR> strcat(Player1,=20
sp);<BR> strcat(Player1, player_array[(int) (P1[0] -=20
'1')].last);<BR> strcpy(Player2, player_array[(int) (P2[0] - =
'1')].first); </FONT></DIV>
<DIV><FONT face=3DArial size=3D2> strcat(Player2, =
sp);<BR> =20
strcat(Player2, player_array[(int) (P2[0] - =
'1')].last); =20
</FONT></DIV>
<DIV><FONT face=3DArial =
size=3D2> return;<BR>}<BR></FONT></DIV></BODY></HTML>
------=_NextPart_000_000A_01BF61C2.1E6D6A20--
- Raw text -