{$M $1024,0,61000}
uses dos,crt,graph;
var
 PSW,b,pr,r:string;
 size:word;
 p:pointer;
 hel,cu,kk,IESI,esc,EC1,en,EC2:boolean;
 lx1,lx,xmax,x:BYTE;
 Gd, Gm,i,j: INTEGER;
 tas:longint;q:char;
 Mode: BYTE;
 c,ec,d,a:BYTE;
 ti1,ti2,ti3:word;
procedure beep;
begin
  Sound(220);
  Delay(200);
  NoSound;
end;
procedure time;
function z(w:word):string;
var s:string;
begin
str(w:0,s);
if length(s)=1 then s:='0'+s;
z:=s;
end;
var t1,t2,t3,t4:word;
    t:string;
begin
gettime(t1,t2,t3,t4);
if ti3<>t3 then
begin
setfillstyle(9,1);
bar(585,34,613,52);
if ti2<>t2 then
begin
bar(558,34,582,52);
if ti1<>t1 then bar(528,34,555,52);
end;
end;
gettime(t1,t2,t3,t4);
t:=z(t1)+':'+z(t2)+':'+z(t3);
settextstyle(7,0,2);
outtextxy(530,30,t);
ti3:=t3;ti2:=t2;ti1:=t1;
end;
PROCEDURE ECRANUL1;
BEGIN
 EC2:=FALSE;
 EC1:=TRUE;
 xmax:=8;
 setfillstyle(10,5);{9,1}
 bar(0,0,640,480);
 setcolor(11);
 settextstyle(1,0,5);
 OutTextXY(190,1,'Metode'); settextstyle(1,0,1);OutTextXY(360,20,'de sortare');
 setcolor(10);
 settextstyle(1,0,1);
     outtextxy(20,45,'Nasa Research Laboratories');
    outtextxy(430,440,'Author: Matei Ioan');
 settextstyle(1,0,2);
 OUTTEXTXY(230,120,'Numarare');
 OUTTEXTXY(230,160,'Insertie');
 OUTTEXTXY(230,200,'Selectie');
 OUTTEXTXY(230,240,'Bubble sort');
 OUTTEXTXY(230,280,'Shell');
 OUTTEXTXY(230,320,'Quicksort');
 OUTTEXTXY(230,360,'Interclasare');
 OUTTEXTXY(230,400,'Iesire');
 X:=1;
 putimage(210,x*40+80,p^,1);
END;
procedure numar;
type vector=array[1..100] of real;
 var i,m:integer;
     a:vector;
     f,g:text;el,h:real;
procedure numarare(a:vector);
var i,j,n:integer;b,k:vector;
begin
n:=0;
for j:=1 to m do
 begin
  for i:=1 to m do
   if a[j]>a[i] then n:=n+1;
   k[j]:=n;
   n:=0;
 end;
for i:=1 to m do
begin
b[trunc(k[i]+1)]:=a[i];
end;
assign(g,'ORDONAT.TXT');
    rewrite(g);
     for i:=1 to m-1 do writeln(g,b[i]:1:3, ' ');
     write(g,b[m]:1:3);
     close(g);
     reset(g);
     writeln('sirul ordonat :');
     repeat
       read(g,el);
       writeln(el:1:3,' ');
     until Eoln(g);
    close(g);
  readln;
end;
begin
  assign(f,'SIR.TXT');
 reset(f);
 i:=0;
  repeat
    i:=i+1;
    readln(f,a[i]);
  until eoln(f);
   close(f);
  m:=i;
numarare(a);
end;

PROCEDURE ECRANUL2;
BEGIN
 EC1:=FALSE;
 EC2:=TRUE;
 setfillstyle(9,1);
 bar(0,0,640,480);
 settextstyle(1,0,8);
 setcolor(11);
CASE X OF
1:BEGIN
 setcolor(10);

  gotoxy(23,16);
  end;
2:BEGIN
 setcolor(10);
    outtextxy(100,100,'OK!!!!');
 settextstyle(1,0,0);
 END;
3:BEGIN
 setcolor(10);
 settextstyle(1,0,0);
   outtextxy(100,100,'OK!!!!');
 END;
4:BEGIN
    outtextxy(100,100,'OK!!!!');
 END;
5:BEGIN
 setcolor(10);
 settextstyle(1,0,0);
   outtextxy(100,100,'OK!!!!');
 END;
6:BEGIN
 setcolor(10);
 settextstyle(1,0,0);
   outtextxy(100,100,'OK!!!!');
 END;
7:BEGIN
 setcolor(10);
 settextstyle(1,0,0);
   outtextxy(100,100,'OK!!!!');
 END;
8:BEGIN
 setcolor(10);
 settextstyle(1,0,0);
   outtextxy(100,100,'OK!!!!');
 END;
9:BEGIN
 OutTextXY(170,111,'PAROLA!!');
 setcolor(10);
 settextstyle(1,0,0);
 en:=true;
END;
END;
END;
PROCEDURE TASTE;
var
ky:char;
begin
if keypressed then
begin
ky:=readkey;
kk:=true;
lx:=x;
lx1:=x;
CASE ky OF
 #72 : x:=x-1;
 #80 : x:=x+1;
 #75 : X:=1;
 #77 : x:=xmax;
 #13 : en:=true;
 #27 : esc:=true;
{ #32 : hel:=true;}
end;
IF X<1 THEN X:=xmax;
IF X>XMAX THEN X:=1;
if lx1=x then cu:=false else cu:=true;
if (en) and (x=xmax) then esc:=true;
end
else
begin kk:=false end;
end;
procedure init;
BEGIN
IESI:=false;
Gd := detect;
InitGraph(Gd, Gm, 'd:\limbaje\tp7\bgi');
setfillstyle(1,15);
Bar(0, 0, GetMaxX, GetMaxY);
Size := ImageSize(0, 0, 200, 40);
GetMem(P, Size);
GetImage(0, 0, 200, 40, P^);
end;
procedure autor;
begin
  cleardevice;
    setfillstyle(1,red);bar(160,100,450,400);
    setcolor(white);
    rectangle(162,102,448,398);rectangle(164,104,446,396);
    setcolor(yellow);settextstyle(defaultfont,0,1);
    outtextxy(170,125,'Author     Matei Ioan');
    outtextxy(170,170,'Job        student at M.Eminescu');
    outtextxy(170,185,'               Highschool ');
    outtextxy(170,225,'Adress      Street Progresului,');
    outtextxy(170,240,'              nr. x ');
    outtextxy(170,285,'Phone      (040)-059 447442');
    outtextxy(170,330,'E-mail     lampadar@rdsor.ro');
{    outtextxy(170,345,'www: http://www.mattew@antivir.com');}
    outtextxy(250,380,'Press any key to exit');
    settextstyle(1,0,0);
   { SetTextJustify(1, 1);}
     SetRGBPalette(Blue, 0, 0, 0);
     SetColor(Blue);
     OutTextXy(110, 30, 'Remember ...');
     Repeat
           For I := 1 To 63 Do
           SetRGBPalette(Blue, I, I, I);
           For I := 63 DownTo 1 Do
           SetRGBPalette(Blue, I, I, I);
     Until KeyPressed;
end;
procedure litere;
begin
     settextstyle(defaultfont,0,1);
     if q=#32 then
     clearviewport;cleardevice;
     setcolor(14);rectangle(2,4,getmaxx-2,getmaxy-4);
     setcolor(14);rectangle(4,6,getmaxx-4,getmaxy-6);
     setcolor(0);rectangle((getmaxx div 3)+30,4,2*(getmaxx div 3)-1,4);
     setcolor(0);rectangle((getmaxx div 3)+30,6,2*(getmaxx div 3)-1,6);
     setcolor(6);outtextxy((getmaxx div 3)+37,6,'MattSoft International');
                 outtextxy(230,450,'Press any key to exit');
  repeat
    setbkcolor(0);
    setcolor(4);settextstyle(defaultfont,0,5);outtextxy(150,200,'M');
    setcolor(7);settextstyle(defaultfont,0,5);outtextxy(200,200,'A');
    setcolor(12);settextstyle(defaultfont,0,5);outtextxy(250,200,'T');
    setcolor(9);settextstyle(defaultfont,0,5);outtextxy(300,200,'T');
    setcolor(10);settextstyle(defaultfont,0,5);outtextxy(350,200,'E');
    setcolor(6);settextstyle(defaultfont,0,5);outtextxy(400,200,'W');
      delay(26);
    setcolor(0);settextstyle(defaultfont,0,5);outtextxy(150,200,'M');
    setcolor(0);settextstyle(defaultfont,0,5);outtextxy(200,200,'A');
    setcolor(0);settextstyle(defaultfont,0,5);outtextxy(250,200,'T');
    setcolor(0);settextstyle(defaultfont,0,5);outtextxy(300,200,'T');
    setcolor(0);settextstyle(defaultfont,0,5);outtextxy(350,200,'E');
    setcolor(0);settextstyle(defaultfont,0,5);outtextxy(400,200,'W');
    setcolor(1);settextstyle(defaultfont,0,5);outtextxy(150,150,'M');
    setcolor(11);settextstyle(defaultfont,0,5);outtextxy(200,200,'A');
    setcolor(5);settextstyle(defaultfont,0,5);outtextxy(250,130,'T');
    setcolor(8);settextstyle(defaultfont,0,5);outtextxy(300,200,'T');
    setcolor(6);settextstyle(defaultfont,0,5);outtextxy(350,140,'E');
    setcolor(3);settextstyle(defaultfont,0,5);outtextxy(400,200,'W');
      delay(26);
    setcolor(0);settextstyle(defaultfont,0,5);outtextxy(150,150,'M');
    setcolor(0);settextstyle(defaultfont,0,5);outtextxy(200,200,'A');
    setcolor(0);settextstyle(defaultfont,0,5);outtextxy(250,130,'T');
    setcolor(0);settextstyle(defaultfont,0,5);outtextxy(300,200,'T');
    setcolor(0);settextstyle(defaultfont,0,5);outtextxy(350,140,'E');
    setcolor(0);settextstyle(defaultfont,0,5);outtextxy(400,200,'W');

    setcolor(15);settextstyle(defaultfont,0,5);outtextxy(150,100,'M');
    setcolor(13);settextstyle(defaultfont,0,5);outtextxy(200,180,'A');
    setcolor(14);settextstyle(defaultfont,0,5);outtextxy(250,110,'T');
    setcolor(3);settextstyle(defaultfont,0,5);outtextxy(300,180,'T');
    setcolor(1);settextstyle(defaultfont,0,5);outtextxy(350,120,'E');
    setcolor(14);settextstyle(defaultfont,0,5);outtextxy(400,180,'W');
      delay(26);
    setcolor(0);settextstyle(defaultfont,0,5);outtextxy(150,100,'M');
    setcolor(0);settextstyle(defaultfont,0,5);outtextxy(200,180,'A');
    setcolor(0);settextstyle(defaultfont,0,5);outtextxy(250,110,'T');
    setcolor(0);settextstyle(defaultfont,0,5);outtextxy(300,180,'T');
    setcolor(0);settextstyle(defaultfont,0,5);outtextxy(350,120,'E');
   setcolor(0);settextstyle(defaultfont,0,5);outtextxy(400,180,'W');

    setcolor(12);settextstyle(defaultfont,0,5);outtextxy(150,100,'M');
    setcolor(7);settextstyle(defaultfont,0,5);outtextxy(200,150,'A');
    setcolor(4);settextstyle(defaultfont,0,5);outtextxy(250,95,'T');
    setcolor(2);settextstyle(defaultfont,0,5);outtextxy(300,150,'T');
    setcolor(15);settextstyle(defaultfont,0,5);outtextxy(350,105,'E');
    setcolor(5);settextstyle(defaultfont,0,5);outtextxy(400,150,'W');
      delay(26);
    setcolor(0);settextstyle(defaultfont,0,5);outtextxy(150,100,'M');
    setcolor(0);settextstyle(defaultfont,0,5);outtextxy(200,150,'A');
    setcolor(0);settextstyle(defaultfont,0,5);outtextxy(250,95,'T');
    setcolor(0);settextstyle(defaultfont,0,5);outtextxy(300,150,'T');
    setcolor(0);settextstyle(defaultfont,0,5);outtextxy(350,105,'E');
    setcolor(0);settextstyle(defaultfont,0,5);outtextxy(400,150,'W');

    setcolor(2);settextstyle(defaultfont,0,5);outtextxy(150,170,'M');
    setcolor(11);settextstyle(defaultfont,0,5);outtextxy(200,110,'A');
    setcolor(14);settextstyle(defaultfont,0,5);outtextxy(250,170,'T');
    setcolor(7);settextstyle(defaultfont,0,5);outtextxy(300,110,'T');
    setcolor(1);settextstyle(defaultfont,0,5);outtextxy(350,170,'E');
    setcolor(2);settextstyle(defaultfont,0,5);outtextxy(400,110,'W');
      delay(26);
    setcolor(0);settextstyle(defaultfont,0,5);outtextxy(150,170,'M');
    setcolor(0);settextstyle(defaultfont,0,5);outtextxy(200,110,'A');
    setcolor(0);settextstyle(defaultfont,0,5);outtextxy(250,170,'T');
    setcolor(0);settextstyle(defaultfont,0,5);outtextxy(300,110,'T');
    setcolor(0);settextstyle(defaultfont,0,5);outtextxy(350,170,'E');
    setcolor(0);settextstyle(defaultfont,0,5);outtextxy(400,110,'W');
  until keypressed;cleardevice;
end;
 procedure virus;
 begin
  cleardevice;setfillstyle(1,1);bar(1,1,640,480);setcolor(lightred);
            rectangle(10,(getmaxy div 2)-15,getmaxx-10,(getmaxy div 2)+15);
            settextstyle(triplexfont,0,2);
            outtextxy(13,(getmaxy div 2)-50,'0%');
            outtextxy(getmaxx div 2,(getmaxy div 2)-50,'50%');
            outtextxy(getmaxx-60,(getmaxy div 2)-50,'100%');
            i:=10;setcolor(lightgreen);
            setcolor(14);
            outtextxy(1,166,'This anti-virus program is scaning your memory for viruses');
            repeat
              line(i,(getmaxy div 2)-10,i,(getmaxy div 2)+10);delay(10);
              sound(i);
            i:=i+1;
            until i=getmaxx-10;
            nosound;
              settextstyle(1,0,1);
          setcolor(magenta);
       rectangle(31,151,580,249);rectangle(33,153,577,248);setfillstyle(1,green);bar(33,153,577,248);
           setcolor(black);
       outtextxy(199,150,'R E P O R T');outtextxy(40,170,'Please do not worry,your memory is not yet in danger');
       outtextxy(120,207,'Find:  No   Infected items');
       outtextxy(120,221,'       No   Suspicious ram size');
            readln;end;
procedure tasn;
begin
tas:=tas+1;
if kk then tas:=0;
if tas>2000 then
begin
tas:=0
end;
end;
PROCEDURE CURSOR;
BEGIN
putimage(210,x*40+80,p^,1);
putimage(210,lx*40+80,p^,1);
END;
BEGIN
INIT;
ECRANUL1;
WHILE IESI=false DO
 BEGIN
  time;
  taste;
  {tasn;}
  IF KK THEN
  BEGIN
  if cu then CURSOR;
   KK:=FALSE;
   IF ESC THEN
   IF EC1 THEN IESI:=true ELSE ECRANUL1 ; ESC:=FALSE;
   IF EN AND EC1 THEN
    BEGIN
    EC1:=FALSE;
    EN:=FALSE;
    ECRANUL2;delay(1000);ecranul1;
    END;
  END;
 end;
virus;autor;readkey;litere;
closegraph;
halt(1)
end.
