D
D
Di Da2018-10-03 18:08:27
Pascal
Di Da, 2018-10-03 18:08:27

How to solve this "bug" with loop and array?

program test;
var
c,i,n:integer;
t:string;
testdata:array[1..5,1..5] of string;
Begin
Writeln('1 - Создать тест');
Writeln('2 - Тесты');
write('Мой выбор: ');
read(c);
Case c of
1:
begin
n:=1;
i:=1;
writeln('');
while i<5 do
begin
write(n,' вопрос: ');
readln(testdata[1,n]);
write('А)');
readln(testdata[2,n]);
i:=i+1;
n:=n+1;
end;
end;

end;
End.

In college, they were given the task of doing a test, here is the program itself (its beginning). It outputs:
1 question: 2 question:
Data entry.
But I need to enter a question, options, and she is dumb if you use an array in read. You will understand everything if you follow this program.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexyz Canson, 2018-12-01
@jone21

maybe you made a mistake with the read command - the command for reading a file

ReadLn(S);
WriteLn('Вы ввели : ', S);

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question