# GÓC CÔNG NGHỆ > Tin tức công nghệ > Các sản phẩm mới > Gaming Gear >  Pascal

## pesttykl

Em mới lập trình "Chiếc non kì diệu" từ Pascal.
mong mọi người dùng thử và cho ý kiến![IMG]data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABAQMAAAA  l21bKAAAAA1BMVEXh5PJm+yKVAAAAAXRSTlMAQObYZgAAAApJR  EFUCNdjYAAAAAIAAeIhvDMAAAAASUVORK5CYII=[/IMG][IMG]data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABAQMAAAA  l21bKAAAAA1BMVEXh5PJm+yKVAAAAAXRSTlMAQObYZgAAAApJR  EFUCNdjYAAAAAIAAeIhvDMAAAAASUVORK5CYII=[/IMG][IMG]data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABAQMAAAA  l21bKAAAAA1BMVEXh5PJm+yKVAAAAAXRSTlMAQObYZgAAAApJR  EFUCNdjYAAAAAIAAeIhvDMAAAAASUVORK5CYII=[/IMG]


```
program Chiec_Non_Ki_Dieu;
uses crt;
var sailt,lien,sorandom,truoc,i,dung,diem:longint;
    s:string;
    doandung:boolean;
    doan:char;
begin clrscr;
 textcolor(2);
 writeln('Luat choi:');
 writeln;
 textcolor(3);
 writeln('   - Tra loi cau hoi bang cach doan cac chu cai trong o trong (#).');
 writeln('   - Neu tra loi dung, tong diem se duoc cong them vao bang so chua cai nhan ');
 writeln('  voi so diem quay duoc va cac o chu tuong ung voi chu do se duoc mo ra.');
 writeln('   - Neu ban tra loi sai 3 lan lien tiep, tro choi se ket thuc!');
 writeln;
 writeln('  * Luu y: + Cac chu cai ban da tra loi roi khong duoc tra loi lai!');
 writeln('           + Cac tu duoc xep lien tiep nhau, khong co dau cach.');
 writeln;
 textcolor(6);
 write('                 An phim bat ki de choi ...');
 readkey;
 clrscr;
 randomize;
 lien:=0;sailt:=0;
 s:='DIENDANTINHOCVIETNAM';
 textcolor(10);
 writeln('              CHUONG TRINH CHIEC NON KI DIEU KINH CHAO QUY VI!');
 textcolor(7);
 writeln;
 writeln('Cau hoi:');
 writeln('   Ten Dien dan cua chung ta!');
 writeln('O chu co ',length(s),' chu cai');
 gotoxy(30,7);
 for i:=1 to length(s) do write('#');
 writeln;
 doandung:=false;
 while dung<length(s) do
  begin
   gotoxy(15,13);
   write('    Tong diem cua ban la: ',diem);
   gotoxy(10,12);
   textcolor(9);
   sorandom:=random(10)+1;
  {write('Diem cua ban quay duoc la: ',sorandom,'00     ');}
   {}
   write('Diem cua ban quay duoc la: ');
   write('500');delay(30);gotoxy(37,12);
   write('400');delay(30);gotoxy(37,12);
   write('100');delay(30);gotoxy(37,12);
   write('300');delay(30);gotoxy(37,12);
   write('200');delay(30);gotoxy(37,12);
   write('500');delay(30);gotoxy(37,12);
   write('400');delay(30);gotoxy(37,12);
   write('100');delay(30);gotoxy(37,12);
   write('300');delay(30);gotoxy(37,12);
   write('200');delay(30);gotoxy(37,12);
   write('500');delay(30);gotoxy(37,12);
   write('400');delay(30);gotoxy(37,12);
   write('100');delay(30);gotoxy(37,12);
   write('300');delay(30);gotoxy(37,12);
   write('200');delay(30);gotoxy(37,12);
   write('500');delay(30);gotoxy(37,12);
   write('400');delay(30);gotoxy(37,12);
   write('100');delay(30);gotoxy(37,12);
   write('300');delay(30);gotoxy(37,12);
   write('200');delay(30);gotoxy(37,12);
   write('500');delay(30);gotoxy(37,12);
   write('400');delay(30);gotoxy(37,12);
   write('100');delay(30);gotoxy(37,12);
   write('300');delay(30);gotoxy(37,12);
   write('200');delay(30);gotoxy(37,12);
   write('500');delay(30);gotoxy(37,12);
   write('400');delay(30);gotoxy(37,12);
   write('100');delay(30);gotoxy(37,12);
   write('300');delay(30);gotoxy(37,12);
   write('200');delay(30);gotoxy(37,12);
   write('500');delay(30);gotoxy(37,12);
   write('400');delay(30);gotoxy(37,12);
   write('100');delay(30);gotoxy(37,12);
   write('300');delay(30);gotoxy(37,12);
   write('200');delay(30);gotoxy(37,12);
   write('500');delay(30);gotoxy(37,12);
   write('400');delay(30);gotoxy(37,12);
   write('100');delay(30);gotoxy(37,12);
   write('300');delay(30);gotoxy(37,12);
   write('200');delay(30);gotoxy(37,12);
   write('500');delay(30);gotoxy(37,12);
   write('400');delay(30);gotoxy(37,12);
   write('100');delay(30);gotoxy(37,12);
   write('300');delay(30);gotoxy(37,12);
   write('200');delay(30);gotoxy(37,12);
   write('500');delay(30);gotoxy(37,12);
   write('400');delay(30);gotoxy(37,12);
   write('100');delay(30);gotoxy(37,12);
   write('300');delay(30);gotoxy(37,12);
   write('200');delay(30);gotoxy(37,12);
   write('500');delay(30);gotoxy(37,12);
   write('400');delay(30);gotoxy(37,12);
   write('100');delay(30);gotoxy(37,12);
   write('300');delay(30);gotoxy(37,12);
   write('200');delay(30);gotoxy(37,12);
   write(sorandom,'00     ');
   {}
   textcolor(7);
   gotoxy(1,8);
   writeln('                                                 ');
   writeln('                                                                 ');
   writeln('                                                                 ');
   write('                                                                 ');
   gotoxy(1,8);
   write('Ban doan chu:');
   readln(doan);
   doan:=upcase(doan);
   for i:=1 to length(s) do if doan=s[i] then inc(lien);
   for i:=1 to length(s) do if doan=s[i] then
     begin
      doandung:=true;
      s[i]:='%';
      diem:=diem+sorandom*100;
      gotoxy(1,9);
      textcolor(11);
      write('                    Chu ',doan,', co ',lien,' chu ',doan);
      textcolor(7);
      gotoxy(30+i-1,7);
      write(doan);
      inc(dung);
     end;
   lien:=0;
   if doandung=false then
    begin
     inc(sailt);
     gotoxy(1,9);
     textcolor(10);
     write('                    Ban doan sai rui! Doan lai nhe!');
     textcolor(7);
    end
   else sailt:=0;
   doandung:=false;
   gotoxy(1,10);
   writeln('    An phim bat ki de doan tiep!');
   readkey;
   if sailt=3 then break;
  end;
gotoxy(1,1);
writeln('                                                                         ');
writeln('                                                                         ');
writeln('                                                                         ');
writeln('                                                                         ');
writeln('                                                                         ');
writeln('                                                                         ');
writeln('                                                                         ');
writeln('                                                                         ');
writeln('                                                                         ');
writeln('                                                                         ');
writeln('                                                                         ');
writeln('                                                                         ');
writeln('                                                                         ');
writeln('                                                                         ');
if sailt=3 then
 begin
  textcolor(19);
  gotoxy(23,10);
  write('Ban da doan sai lien tiep 3 lan!');
 end;
gotoxy(14,12);
textcolor(20);
writeln('Tro choi ket thuc. Diem so cuoi cung cua ban la: ',diem);
 readln;
end.
```

----------


## cameraquansat

Mọi người chơi "Chiếc nón kì diệu" có thể thay đổi câu hỏi và đáp an.
Thay đổi câu hỏi ở sau câu lệnh " writeln('Cau hoi:');"
còn thay đổi đáp án bằng cách thay đổi giá trị xâu S. VD: s='DAPAN';
Chúc vui!:d:d:d

----------

