当前位置:编程学习 > C/C++ >>

纯C语言的一个程序。

本人对C的一些高级运用还是不了解的。希望各位高人指导一下。
这是代码:
#include<stdio.h>
#include<conio.h>
int main()
{
textbackground(LIGHTBLUE);
textcolor(YELLOW);
cprintf("********************************************************************************");
cprintf("* *");
cprintf("* ^_^ Welcome to the game! ^_^ *");
cprintf("* Game Rules: *");
cprintf("* 3 men take 3 retainers and goods to pass the river, the boat carrys *");
cprintf("* 2 persons each time. In passing the river, at any bank number of *");
cprintf("* men must be more than the number of the retainers, or the retainers *");
cprintf("* will kill the men and take the goods. *");
cprintf("* Game operations: <1> Input the number of men and retainers in turn; *");
cprintf("* <2> Input error keys, the game will restart. *");
cprintf("********************************************************************************");
cprintf("* *");
cprintf("* *");
cprintf("* Press any key to start game. <Q key to quit>... *");
cprintf("* *");
cprintf("* *");
cprintf("* *");
cprintf("* *");
cprintf("* *");
cprintf("* *");
cprintf("* *");
cprintf("* *");
cprintf("* *");
cprintf("* *");
cprintf("*******************************************************************************");
gotoxy(61,14);
getch();
}

如何将右下角的那个黑色方块也变成*号。
就像这个图:

注意哦。不能让第一排的*消失。
补充:cprintf("* *");。两个星号之间是有很多空格的。问问不允许连续的多个空格。
		
追问:显然不行。gotoxy函数只是控制光标的位置。
答案:#include<stdio.h>
#include<conio.h>
int main()
{
textbackground(BLUE);
clrscr( );
textcolor(YELLOW);
cprintf("********************************************************************************");
cprintf("* *");
cprintf("* ^_^ Welcome to the game! ^_^ *");
cprintf("* Game Rules: *");
cprintf("* 3 men take 3 retainers and goods to pass the river, the boat carrys *");
cprintf("* 2 persons each time. In passing the river, at any bank number of *");
cprintf("* men must be more than the number of the retainers, or the retainers *");
cprintf("* will kill the men and take the goods. *");
cprintf("* Game operations: <1> Input the number of men and retainers in turn; *");
cprintf("* <2> Input error keys, the game will restart. *");
cprintf("********************************************************************************");
cprintf("* *");
cprintf("* *");
cprintf("* Press any key to start game. <Q key to quit>... *");
cprintf("* *");
cprintf("* *");
cprintf("* *");
cprintf("* *");
cprintf("* *");
cprintf("* *");
cprintf("* *");
cprintf("* *");
cprintf("* *");
cprintf("********************************************************************************");
gotoxy(62,14);
getch();
}
这样你看行不?
最后一行多输出一个星号.
你在最后一排的cprintf("*******************************************************************************");
里面多加一个*就行了

上一个:用C语言写出如下算法
下一个:C语言问题,求解

CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,