我是一个新手,但我花了很多时间试图了解我在这里做错了什么。
我正在使用 Turbo C,有时我得到的输出消息实际上是 Borland Turbo C 文本的一部分,所以似乎文本没有存储在 char lossmsg..
void lose(int d) //Different messages for different deaths
{
char *losemsg; //Lose message
setcolor(4);
settextstyle(0,0,1); //Set font size
switch(d)
{
case '1': losemsg="STOP HURTING THE WALL!"; //Hitting the wall
break;
case '2': losemsg="Like all great dictators, you've fallen...!"; //Falling
break;
case '3': losemsg="Oh well, sucks to be you...";
break;
case '4': losemsg="You've been killed by a spike, how sad..."; //Spike
break;
case '5': losemsg="You've been hit by something that defies gravity!";
break;
case '6': losemsg="There is no lifeguard, you've drowned!"; //Drowning
break;
}
outtextxy(100,150,losemsg);
delay(2000);
}