英语和Turbo Pascal 7达人请帮个忙~~~

来源:百度知道 编辑:UC知道 时间:2024/05/08 17:13:02
以下这些全都是英语,大概意思是说要用Turbo Pascal 7编个叫guess the number的游戏程序.电脑随机选择1~10之间的数字,然后使用者有3次机会猜,猜对了就游戏结束,没猜对也不能猜第4次.
还要改变屏幕和字体的颜色...达人们帮个忙吧...= =
-----------------------------------------------------------------
Task

Design and implement a Pascal program for a game called GUESS THE NUMBER.In doing so you are to follow the Software Development Cycle and produce:
1,A word-processed document with the following:
-problem definition
-solution specification
-testing comments
-an evaluation of the program
2.Source code of the program in Pascal
3.A working computer program to the specifications below.

Task Requirements

GUESS THE NUMBER is a number guessing game.The game is played until the number is guessed.Your program must be original and include
-Use of the sound procedure to enhance the user interface
-An attractive use screen,including use of colour
-Suitable messages welcoming the user and inviting the

简单翻译下.

任务

设计一个猜数字的Pascal游戏.制作中你得.....
1.(没用)
.....

任务要求

就和你说的差不多.

我对TP有一定研究,看来你找对人了.
改变颜色要用到Crt单元,你应该知道单元吧?
什么?不知道?
总之你在var前面加一句
uses crt;
就行了.这个单元里有许多新增的字符处理语句.
介绍下:
textcolor(color);
这个过程可以改变目前字体的颜色.Color为0--15的任意一个数字,分别代表16种颜色.这些数字也可以用颜色代替,例如:
textcolor(1); 以及
textcolor(red);都是合法的.
用了过程之后,以后输出的字体就是这个颜色了.
接下来,这是设置背景颜色的过程:
textbackground(color)
用法和刚才的一样;

最后介绍一下random和randomize函数;
random用于产生一个随机数,比如random(9)就会从0-8中随意产生一个整数.
在用这条语句前,必须用randomize过程初始化,否则每次随机的都是固定的数.
再来这个游戏啦.

Program Guess;
uses crt;
var
guess,you,i:byte;{定义Guess为0-127之间的一个数字,即我们要猜的数.不定义它为integer是因为这个数在1-10间,用不着integer那么大,用byte节约内存.you为你猜的数.i为已经猜的次数}
pan:boolean;{用于判断数据是否符合要求}
begin
randomize;{初始化随机数}
guess:=random(10)+1;{很明显,这样一来产生的数就在1-10间了}
repeat
pan:=true;{先假定符合要求}
readln(you);{等待玩家输入