Bernard aka Bullet: How can i make a pascal quiz program please?
I need this for my school project and i don’t have any idea how to begin.. The pascal program i use is pascal 7.0.. Can you give me an example of a quiz program?
Answers and Views:
Answer by jplatt39
A quiz program can be anything which asks questions, tallies correct answers and gives you the correct number of answers. Here is a VE-ERY simple one:
program quiz;
var
counter : INTEGER;
Input : CHAR;
begin
counter :=0;
writeln(‘Welcome to my short quiz.’);
writeln(‘The creator of the Free Software Foundation was’);
writeln(‘1. Richard Stallman’);
writeln(‘2. Linus Torvalds’);
writeln(‘3. Jean-Louis Gasee’);
write(‘Your choice:’);
readln(Input);
if (Input=’1′) then counter:=counter+1;
writeln(‘According to Richard Stallman Free Software is free as in’);
writeln(‘1.Freedom’);
writeln(‘2.Beer’);
write(‘Your choice:’);
readln(Input);
if (Input=’1′) then counter:=counter+1;
writeln(‘Thank you for taking my quiz.’);
write(‘You got ‘);
write(counter);
writeln(‘ correct.’);
end.
This program was compiled using GNU Pascal and run on a Gentoo Linux laptop. If you were to hand it in you would need to do things like add necessary comment and I don’t recommend doing that. However by looking at and improving it it should help you understand how you come up with and design a suitable quiz program.
Leave a Reply