Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- program Tap_danh_chu;
- uses
- {$IFDEF UNIX}{$IFDEF UseCThreads}
- cthreads,
- {$ENDIF}{$ENDIF}
- crt,dos
- { you can add units after this };
- type int = longint;
- {+N}
- var f : text;
- s : array[1..100] of string;
- n,ans : int;
- time : real;
- fault : int;
- start : longint;
- now : longint absolute 0:$46C;
- procedure cover(color:int);
- var i,j:int;
- begin
- textcolor(color); textbackground(color);
- for I:=1 to 26 do for j:=1 to 80 do write('C');
- textcolor(green);
- end;
- procedure writesl(s:string);
- var i:int;
- begin
- for i:=1 to length(s) do begin write(s[i]); delay(19); end;
- end;
- procedure head;
- begin
- cover(7);
- textcolor(black);
- Gotoxy(35,12); writesl('TYPING MASTER'); delay(1000);
- gotoxy(1,25); writesl('CREATED by : '); textcolor(red);
- writesl('Coding to the sun'); delay(1000);
- textcolor(black);
- gotoxy(1,1); writesl('Copy right Dos ''n'' Pascal inc'); delay(1000);
- repeat
- Gotoxy(67,25); writesl('Press any key'); delay(400);
- gotoxy(67,25); clreol;
- until keypressed;
- end;
- procedure ins;
- begin
- writeln('When you done the text, you should type space to end it ! ');
- writeln;
- writeln('The text apears only when you type the right wrords ');
- writeln;
- writeln('if you type the wrong words, you fail one score ');
- writeln;
- writeln('press enter');
- end;
- procedure menu;
- begin
- clrscr;
- gotoxy(35,3); writesl('Beginner '); write('1');
- gotoxy(35,4); writesl('Easy '); write('2');
- gotoxy(35,5); writesl('Medium '); write('3');
- gotoxy(35,6); writesl('Expert '); write('4');
- gotoxy(35,7); writesl('Free text file '); write('5');
- gotoxy(35,8); writesl('INSTRUCTION ! '); write('6');
- gotoxy(1,24); write('YOU CHOSE : '); read(ans); clrscr;
- if ans=6 then begin ins; repeat until keypressed; menu; end;
- end;
- procedure typing;
- var inp :char;
- d,w,dem :int;
- x1,y1 :int;
- x,y,count:int;
- begin
- textcolor(black); d:=1 ; count:=0;
- w:=1;
- x:=1; y:=1; x1:=wherex; y1:=wherey; dem:=0;
- start:=now;
- textcolor(green);
- repeat
- inp:=readkey;
- if inp=#27 then begin clrscr; textcolor(red); write('you quit !!'); readln; exit; end;
- if (inp<> s[d][w])and(s[d][w]<>#13) then
- repeat
- inp:=readkey; inc(fault);
- until inp=s[d][w];
- write(inp);
- if inp<>' ' then inc(dem); inc(count);
- { }
- textcolor(red);
- gotoxy(x,y); write(s[d][w]); textcolor(green);
- inc(x,1); inc(x1,1); gotoxy(x1,y1); inc(w);
- if x=80 then begin inc(y); x:=1; end;
- if x1=80 then begin inc(y1); x1:=1; end;
- { }
- if s[d][w+1]=#13 then begin x1:=0; inc(y1); inc(count); end;
- if (count=length(s[d])) then
- begin
- inc(d);
- w:=1; count:=1;
- end;
- textcolor(green);
- gotoxy(1,25); write(count,' ');write('words !'); gotoxy(x1,y1);
- textcolor(green);
- until (d=n+1);
- time:=(now-start)/58.62;
- writeln; textcolor(red);
- writeln('FAULT u got : ',fault);
- writeln('TIME running : ',time:0:0);
- readln;
- end;
- procedure proces;
- var k:char; i:int;
- begin
- n:=1; fault:=0;
- case ans of
- 1: begin
- assign(f,'easy1.part'); reset(f);
- while not eof(f) do
- begin
- read(f,k);
- s[n]:=s[n]+k;
- if (length(s[n])>100) then inc(n);
- end;
- for i:=1 to n do write(s[n]); writeln;
- close(f);
- end;
- end;textcolor(red);
- for i:=1 to 38 do write('~'); textcolor(yellow);write('TYPE');
- textcolor(red); for i:=1 to 38 do write('~'); writeln;
- typing;
- end;
- begin
- clrscr;
- head; menu; ans:=1; proces; readln;
- end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement