Hi,
I would need some help to resolve a problem.
I need to create a programm that contain 10 basic math questions.
After 3 fails in a row, the programm must stop. After each question the good answer should show if the student entered the wrong answer, and the result up to now will show.
I hope I explained myself well, english is not my fist language. :-)
So to start, I wrote a programm to ask the first question, then verify the answer, show the result and the good answer if needed. But it was really long and I was only repeating lots of commands.
So I am now trying something else. I would like create a loop, so each question will be asked one by one, the answer would be verified and the result would show.
I created two vector (not sure this is the correct word), one where I assigned the questions and another where I assigned the answer.
PROGRAM travail3q2version2;
{$APPTYPE CONSOLE}
uses Forms;
TYPE
//this is where the questions will be
tab_qsts= Array [1..10] of string[6];
//this is where the answers will be
tab_rep= Array [1..10] of integer;
CONST
//this is the quantity of questions
qst_max = 10;
VAR
reponse: char;
//will be use later on
cumulb, cumulm, cumulr, consb, consm, interup: integer;
a: tab_qsts;
b: tab_rep;
i,j,r: integer;
BEGIN
//will be use later on
cumulb:=0; cumulm:=0; cumulr:=0; consb:=0; consm:=0;
//here I assign the questions in the first vector
a[1]:='1+1'; a[2]:='1+2'; a[3]:='1+3'; a[4]:='1+4'; a[5]:='1+5';
a[6]:='2+1'; a[7]:='2+2'; a[8]:='2+3'; a[9]:='2+4'; a[10]:='2+5';
//here I assign the answers in the second vector
b[1]:=2; b[2]:=3; b[3]:=4; b[4]:=5; b[5]:=6;
b[6]:=3; b[7]:=4; b[8]:=5; b[9]:=6; b[10]:=7;
For i:= 1 to 10 do
For j:= 1 to 10 do
begin
writeln(a);
readln (r);
if (r)=(b[j]) then
begin
writeln('bravo');
end
end
END.
So, I'm only at the first step of the programm. I was expecting to see the first question, then the student to enter the first answer, if fine then "bravo' would had showed, if not the next question would had showed and so on. Then I was planning to add the other command I need to have the test calculate how many failure in a row and other stuf I need to do. But I cant even get the first part to work properly. The way the programm is now, each questions are asked 10 times, but each time with the following answer. So the first question is asked, then the first answer is expected, after the first question is asked again, and the second answer is expected, and so on.
If I erase the "For j:= 1 to 10 do" command, then each question is asked only once, but the answer is not verified.
Can someone tell me what is wrong?
zourha