Please support our Pascal and Delphi advertiser: Programming Forums
Views: 7579 | Replies: 11
![]() |
•
•
Join Date: Mar 2007
Posts: 14
Reputation:
Rep Power: 2
Solved Threads: 0
[quote=needs_help;301144]{a random problem generator, test your math skills}
[code]
program learn;
uses crt;
var a,b,c,e,f,right: integer; d:real;
label 1,2,3,4,5;
begin
textbackground(green);
textcolor(white);
clrscr;
repeat
inc(f);
until f=100000;
randomize;
1:
e:=random(3)+1;
b:=random(200)+1;
c:=random(200)+1;
if e=1 then d:=b+c;
if e=2 then d:=b-c;
if e=3 then d:=b*c;
writeln(' ',b:3);
if e=1 then write('+ ');
if e=2 then write('- ');
if e=3 then write('x ');
writeln(c:3);
writeln('______');
readln(a);
if a=d then
begin
inc(right);
writeln('HORRAY! YOU GOT IT RIGHT! you have ',right,' points!');
end
else
begin
right:=right-1;
writeln('WRONG! you have ',right,' points');
end;
goto 1;
end.
This program you've made work but there are nothing displayed but green
[code]
program learn;
uses crt;
var a,b,c,e,f,right: integer; d:real;
label 1,2,3,4,5;
begin
textbackground(green);
textcolor(white);
clrscr;
repeat
inc(f);
until f=100000;
randomize;
1:
e:=random(3)+1;
b:=random(200)+1;
c:=random(200)+1;
if e=1 then d:=b+c;
if e=2 then d:=b-c;
if e=3 then d:=b*c;
writeln(' ',b:3);
if e=1 then write('+ ');
if e=2 then write('- ');
if e=3 then write('x ');
writeln(c:3);
writeln('______');
readln(a);
if a=d then
begin
inc(right);
writeln('HORRAY! YOU GOT IT RIGHT! you have ',right,' points!');
end
else
begin
right:=right-1;
writeln('WRONG! you have ',right,' points');
end;
goto 1;
end.
This program you've made work but there are nothing displayed but green
![]() |
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)





Linear Mode