chrisgarvey
Technical User
Hello,
I am trying to create my first Pascal Program.
The program is suposed to read in the contence of 2 arrays;
- 1 has the student anwsers to a multi choice exam paper
- other has a specimin anwser.
I am trying to create a program that marks the papers, (there is only 1 correct anwser) and returns the anwser as both:
- a figure out of 10
- a percentage
Below is my code, I would be extremly greatful is someone could look over it for me.
{Program to mark a 10 question multi choice paper}
USES CRT;
{array of anwsers 1 to 10}
Anwser [1] = A
Anwser [2] = B
Anwser [3] = B
Anwser [4] = E
Anwser [5] = A
Anwser [6] = C
Anwser [7] = B
Anwser [8] = A
Anwser [9] = D
Anwser [10] = E
{Array of student anwser 1 to 10}
StudentAnwser [1] = B
StudentAnwser [1] = B
StudentAnwser [1] = B
StudentAnwser [1] = B
StudentAnwser [1] = B
StudentAnwser [1] = E
StudentAnwser [1] = E
StudentAnwser [1] = E
StudentAnwser [1] = D
StudentAnwser [1] = C
{Declaring Variables}
Counter = 0
Score = 0
{Begin Program}
BEGIN
CLRSCR;
Counter = Counter+1;
If Counter > 10 then;
WRITELN('Your Score is'(counter));
WRITELN('Your Percentage Score is'(Counter/10*100)'%');
else;
If StudentAnwser[Counter] = Anwser[Counter];
{correct anwser so add 1 to score}
THEN Score = Score+1;
else;
{incorrect anwser so do nothing}
endif;
endif;
END.
I am trying to create my first Pascal Program.
The program is suposed to read in the contence of 2 arrays;
- 1 has the student anwsers to a multi choice exam paper
- other has a specimin anwser.
I am trying to create a program that marks the papers, (there is only 1 correct anwser) and returns the anwser as both:
- a figure out of 10
- a percentage
Below is my code, I would be extremly greatful is someone could look over it for me.
{Program to mark a 10 question multi choice paper}
USES CRT;
{array of anwsers 1 to 10}
Anwser [1] = A
Anwser [2] = B
Anwser [3] = B
Anwser [4] = E
Anwser [5] = A
Anwser [6] = C
Anwser [7] = B
Anwser [8] = A
Anwser [9] = D
Anwser [10] = E
{Array of student anwser 1 to 10}
StudentAnwser [1] = B
StudentAnwser [1] = B
StudentAnwser [1] = B
StudentAnwser [1] = B
StudentAnwser [1] = B
StudentAnwser [1] = E
StudentAnwser [1] = E
StudentAnwser [1] = E
StudentAnwser [1] = D
StudentAnwser [1] = C
{Declaring Variables}
Counter = 0
Score = 0
{Begin Program}
BEGIN
CLRSCR;
Counter = Counter+1;
If Counter > 10 then;
WRITELN('Your Score is'(counter));
WRITELN('Your Percentage Score is'(Counter/10*100)'%');
else;
If StudentAnwser[Counter] = Anwser[Counter];
{correct anwser so add 1 to score}
THEN Score = Score+1;
else;
{incorrect anwser so do nothing}
endif;
endif;
END.