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.
//this is where the questions will be
tab_qsts= Array [1..10] of string;
//this is where the answers will be
tab_rep= Array [1..10] of integer;
//this is the quantity of questions
qst_max = 10;
//will be use later on
cumulb, cumulm, cumulr, consb, consm, interup: integer;
//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'; a:='1+2'; a:='1+3'; a:='1+4'; a:='1+5';
a:='2+1'; a:='2+2'; a:='2+3'; a:='2+4'; a:='2+5';
//here I assign the answers in the second vector
b:=2; b:=3; b:=4; b:=5; b:=6;
b:=3; b:=4; b:=5; b:=6; b:=7;
For i:= 1 to 10 do
For j:= 1 to 10 do
if (r)=(b[j]) then
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?