Instruction
1
Download a compiler of Pascal from the following page - http://edn.embarcadero.com/article/20803. Read the terms and conditions of use of the software, and then install it.
2
Try to create a game in which the player is required to guess the number between 0 to 100. First, enter the name of the program:program ugadayka;
3
Connect the module CRT:uses crt;
4
Label the variables as follows:var
zagadka,mnenie,popytki:integer;
knopochka:char
zagadka,mnenie,popytki:integer;
knopochka:char
5
Start with clearing the screen and variables, and assigning the target number of pseudo-random values:begin
clrscr;
randomize;
popytki:=0;
mnenie:=0;
zagadka:=int(rnd*100);
clrscr;
randomize;
popytki:=0;
mnenie:=0;
zagadka:=int(rnd*100);
6
Make the computer ask the user what, in his opinion, is the unknown number, as long as he does not guess:while not mnenie=zagadka do
begin
popytki:=popytki+1;
writeln('Attempt number ',popytki,'.');
write('what is your number hidden? ');
phony(mnenie);
if zagadka>mnenie then writeln('No more unknown number!')
else writeln('No, the number is smaller!')
end;
begin
popytki:=popytki+1;
writeln('Attempt number ',popytki,'.');
write('what is your number hidden? ');
phony(mnenie);
if zagadka>mnenie then writeln('No more unknown number!')
else writeln('No, the number is smaller!')
end;
7
Once the number is guessed, the automatic repetition of the above events will stop. Execute the following lines in the program. They make the car display the information that the user has guessed the number:writeln('Congratulations! You guessed the number with attempt number ',popytki,'. It really is ',zagadka,'.');
knopochka:=readkey
knopochka:=readkey
8
Enter the operator for the completion of the program:end.
9
Save the program under any desired name using the menu file -> Save as. In the future, after any editing, save it by pressing F2.
10
To run the program on execution, simultaneously press the Control key and F9.
11
After the completion of the program in order to see what she brought to the screen just before this, simultaneously press the Alt and F5. To return to the editor press this key combination again.