Tin học Chương trình học toán cho các bạn. Mình mới học lậ trình nên có gì sai sót mong các bạn bỏ qua!

HauBright

Học sinh mới
20 Tháng tư 2023
72
36
11
15
Bến Tre
[TẶNG BẠN] TRỌN BỘ Bí kíp học tốt 08 môn
Chắc suất Đại học top - Giữ chỗ ngay!!

ĐĂNG BÀI NGAY để cùng trao đổi với các thành viên siêu nhiệt tình & dễ thương trên diễn đàn.

Program KING_OF_MATH;
Uses Crt;
Var
a,b,c,d,e, //FOR ADDITION
f,g,h,i,j,z,r, //FOR SUBTRACTION
k,l,m,n,o: Integer;
//FOR MULTIPLICATION
lna,lns,lnm: Longint;
ad,sub,multi: Boolean;
{==================================================}

Procedure LIMITED_THE_BIG_NUMBER1;
//FOR ADDITION
Begin
Repeat
textcolor(lightred);
Clrscr;
Writeln('THE WRONG NUMBER!');
Writeln('PLEASE WRITE THE NUMBER LESS THAN 100001 AND GREATER THAN 9');
Write('FROM 1 TO ');
textcolor(yellow);
Readln(lna);
Until lna<100001;
End;
{===============LIMITED THE BIG NUMBER FOR ADDITION==============}
{===================================================}

Procedure LIMITED_THE_SMALL_NUMBER1;
//FOR ADDITION
Begin
Repeat
textcolor(lightred);
Clrscr;
Writeln('THE WRONG NUMBER!');
Writeln('PLEASE WRITE THE NUMBER LESS THAN 100001 AND GREATER THAN 9');
Write('FROM 1 TO ');
textcolor(yellow);
Readln(lna);
Until lna>9;
End;
{=============LIMITED THE SMALL NUMBER FOR ADDITION==============}
{================================================================}

Procedure SCORE1;
Begin
If d=b+c Then e := e+10
Else e := e+0;
End;
{===================SCORE FOR ADDITION============================}

Procedure LIMITED_THE_BIG_NUMBER2;
//FOR SUBTRACTION
Begin
Repeat
textcolor(lightred);
Clrscr;
Writeln('THE WRONG NUMBER!');
Writeln('PLEASE WRITE THE NUMBER LESS THAN 100001 AND GREATER THAN 9');
Write('FROM 1 TO ');
textcolor(yellow);
Readln(lns);
Until lns<100001;
End;
{===============LIMITED THE BIG NUMBER FOR SUBTRACTION==============}
{===================================================================}

Procedure LIMITED_THE_SMALL_NUMBER2;
//FOR SUBTRACTION
Begin
Repeat
textcolor(lightred);
Clrscr;
Writeln('THE WRONG NUMBER!');
Writeln('PLEASE WRITE THE NUMBER LESS THAN 100001 AND GREATER THAN 9');
Write('FROM 1 TO ');
textcolor(yellow);
Readln(lns);
Until lns>9;
End;
{=============LIMITED THE SMALL NUMBER FOR SUBTRACTION==============}
{================================================================}

Procedure SCORE01;
Begin
If i=g-h Then j := j+10
Else j := j+0;
End;
{===================SCORE FOR SUBTRACTION1============================}
{=======================================================}

Procedure SCORE02;
Begin
If i=h-g Then z := z+10
Else z := z+0;
End;
{===================SCORE FOR SUBTRACTION2============================}
{========================================================}

Procedure LIMITED_THE_SMALL_NUMBER3;
//FOR MULTIPLICATION
Begin
Repeat
textcolor(lightred);
Clrscr;
Writeln('THE WRONG NUMBER!');
Writeln('PLEASE WRITE THE NUMBER LESS THAN 101 AND GREATER THAN 4');
Write('FROM 1 TO ');
textcolor(yellow);
Readln(lnm);
Until lnm>4;
End;
{=============LIMITED THE SMALL NUMBER FOR MULTIPLICATION==============}
{=======================================================================}

Procedure LIMITED_THE_BIG_NUMBER3;
//FOR SUBTRACTION
Begin
Repeat
textcolor(lightred);
Clrscr;
Writeln('THE WRONG NUMBER!');
Writeln('PLEASE WRITE THE NUMBER LESS THAN 101 AND GREATER THAN 4');
Write('FROM 1 TO ');
textcolor(yellow);
Readln(lnm);
Until lnm<101;
End;
{================LIMITED THE BIG NUMBER FOR MULTILICATION=============}
{=====================================================================}

Procedure SCORE3;
Begin
If n=l*m Then o := o+10
Else o := o+0;
End;
{======================SCORE FOR MULTIPLICATION=================}
{===============================================================}

Procedure CORRECT;
Begin
textcolor(lightgreen);
Writeln('CORRECT!':50);
End;
{======================CORRECT=======================}
{====================================================}

Procedure INCORRECT;
Begin
textcolor(lightred);
Writeln('INCORRECT!':50);
End;
{=====================INCORRECT======================}
Begin
Clrscr;
textbackground(black);
textcolor(lightblue);
Write(#30:26,'WELCOME TO "');
textcolor(yellow);
Write('KING OF MATH');
textcolor(lightblue);
Writeln('"',#30);
Readln;
{=====================GREETING=======================}
{====================================================}
Clrscr;
delay(1000);
textcolor(lightgreen);
Writeln(#4:5,'IN THIS PROGRAM, YOU WILL DO ADDITION, SUBTRACTION AND MULTIPLICATION PROBLEMS!');
delay(500);
Writeln;
Writeln(#4:5,

'THE NUMBERS IN ADDITION, SUBTRACTION AND MULTIPLICATION WILL BE LIMITED ACCORDING TO YOUR OPINION!'
);
delay(1000);
Writeln;
textcolor(white);
Writeln('PRESS "ENTER" TO CONTINUE!');
Readln;
{====================INSTRUCTION=====================}
{===========================================================================}
textcolor(lightblue);
Clrscr;
Write('LET`S BEGIN WITH 10 "');
textcolor(lightgreen);
Write('ADDITION');
textcolor(lightblue);
Writeln('" PROBLEMS!');
delay(750);
Write('CHOOSE THE LIMITED NUMBER : FROM 1 TO ');
textcolor(yellow);
Readln(lna);
If lna>100001 Then LIMITED_THE_BIG_NUMBER1;
If lna<10 Then LIMITED_THE_SMALL_NUMBER1;
Clrscr;
textcolor(white);
Writeln(#4:33,'ADDITION',#4);
a := 0;
While a<10 Do
Begin
Clrscr;
Randomize;
b := Random(lna);
c := Random(lna);
textcolor(white);
Writeln(#4:33,'ADDITION',#4);
Writeln;
textcolor(lightblue);
Write(' ':32,b,' + ',c,' = ');
textcolor(yellow);
Readln(d);
If (d=b+c) Then ad := True
Else ad := False;
If (ad) Then
Begin
CORRECT;
SCORE1;
End
Else INCORRECT;
delay(500);
a := a+1;
End;
delay(500);
Clrscr;
Delay(1000);
Textcolor(lightblue);
Writeln('YOUR SCORE: ',e,'/100');
Writeln;
delay(1000);
Case e Of
0..30 :
Begin
Textcolor(lightred);
Writeln('TOO BAD!');
End;
40..60 :
Begin
Textcolor(white);
Writeln('THAT`S OKE!');
End;
70..90 :
Begin
Textcolor(yellow);
Writeln('VERY GOOD!');
End;
100 :
Begin
Textcolor(lightgreen);
Writeln('PERFECT!!!');
End;
End;
Readln;
{==========================THE AREA FOR ADDITION==========================}
textcolor(lightblue);
Clrscr;
Write('LET`S BEGIN WITH 10 "');
textcolor(lightgreen);
Write('SUBTRACTION');
textcolor(lightblue);
Writeln('" PROBLEMS!');
delay(750);
Write('CHOOSE THE LIMITED NUMBER : FROM 1 TO ');
textcolor(yellow);
Readln(lns);
If lns>100001 Then LIMITED_THE_BIG_NUMBER2;
If lns<10 Then LIMITED_THE_SMALL_NUMBER2;
Clrscr;
textcolor(white);
Writeln(#4:33,'SUBTRACTION',#4);
f := 0;
While f<10 Do
Begin
Clrscr;
Randomize;
g := Random(lns);
h := Random(lns);
textcolor(white);
Writeln(#4:33,'SUBTRACTION',#4);
Writeln;
If g>h Then
Begin
textcolor(lightblue);
Write(' ':32,g,' - ',h,' = ');
textcolor(yellow);
Readln(i);
If (i=g-h) Then sub := True
Else sub := False;
If (sub) Then
Begin
CORRECT;
SCORE01;
End
Else INCORRECT;
delay(500);
f := f+1;
End;
If g<h Then
Begin
textcolor(lightblue);
Write(' ':32,h,' - ',g,' = ');
textcolor(yellow);
Readln(i);
If (i=h-g) Then sub := True
Else sub := False;
If (sub) Then
Begin
CORRECT;
SCORE02;
End
Else INCORRECT;
delay(500);
f := f+1;
End;
End;
r := j+z;
delay(500);
Clrscr;
Delay(1000);
Textcolor(lightblue);
Writeln('YOUR SCORE: ',r,'/100');
Writeln;
delay(1000);
Case r Of
0..30 :
Begin
Textcolor(lightred);
Writeln('TOO BAD!');
End;
40..60 :
Begin
Textcolor(white);
Writeln('THAT`S OKE!');
End;
70..90 :
Begin
Textcolor(yellow);
Writeln('VERY GOOD!');
End;
100 :
Begin
Textcolor(lightgreen);
Writeln('PERFECT!!!');
End;
End;
Readln;
{==========================THE AREA FOR SUBTRACTION======================}
textcolor(lightblue);
Clrscr;
Write('LET`S BEGIN WITH 10 "');
textcolor(lightgreen);
Write('MULTIPLICATION');
textcolor(lightblue);
Writeln('" PROBLEMS!');
delay(750);
Write('CHOOSE THE LIMITED NUMBER : FROM 1 TO ');
textcolor(yellow);
Readln(lnm);
If lnm>101 Then LIMITED_THE_BIG_NUMBER3;
If lnm<5 Then LIMITED_THE_SMALL_NUMBER3;
Clrscr;
textcolor(white);
Writeln(#4:33,'MULTIPLICATION',#4);
k := 0;
While k<10 Do
Begin
Clrscr;
Randomize;
l := Random(lnm);
m := Random(lnm);
textcolor(white);
Writeln(#4:33,'MULTILICATION',#4);
Writeln;
textcolor(lightblue);
Write(' ':32,l,' * ',m,' = ');
textcolor(yellow);
Readln(n);
If (n=l*m) Then multi := True
Else multi := False;
If (multi) Then
Begin
CORRECT;
SCORE3;
End
Else INCORRECT;
delay(500);
k := k+1;
End;
delay(500);
Clrscr;
Delay(1000);
Textcolor(lightblue);
Writeln('YOUR SCORE: ',o,'/100');
Writeln;
delay(1000);
Case o Of
0..30 :
Begin
Textcolor(lightred);
Writeln('TOO BAD!');
End;
40..60 :
Begin
Textcolor(white);
Writeln('THAT`S OKE!');
End;
70..90 :
Begin
Textcolor(yellow);
Writeln('VERY GOOD!');
End;
100 :
Begin
Textcolor(lightgreen);
Writeln('PERFECT!!!');
End;
End;
Readln;
{=========================THE AREA FOR MULTIPLICATION======================}
Clrscr;
textcolor(lightgreen);
Write(#30:26,'THANKS FOR USING "');
textcolor(yellow);
Write('KING OF MATH');
textcolor(lightgreen);
Writeln('"',#30);
Writeln;
Readln;
End.
 
Last edited:
Top Bottom