坚持实施多项选择计划 [英] Stuck in implementing a multiple choice program

查看:41
本文介绍了坚持实施多项选择计划的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

多种选择测试管理应用程序,将由讲师和学习者使用。并且讲座只能通过直接在表格上打字并将问题和备忘录保存到文本文件中来设置问题,这意味着学生可以通过向往并参加测试并接收结果来进行测试



我尝试了什么:



i已经实现了基础知识,但是当我不得不为问题创建数组以及如何让学生在测试后看到他们的分数。

multiple choice test management application that will be used by both lecturers and learners. and a Lecture can only set the question by directly typing on the form and saving the questions and the memo to a text file and mean while a student can take that test by longing in and taking the test and receiving their results

What I have tried:

i have implemented the basics but im stuck when i have to create arrays for the questions and how to make the student see their marks after the test.

推荐答案

就数组而言,我会存储问题和答案在文件中 - 使它们更容易编辑。如果您将它们存储为每行一个问题和答案,并将它们与不能出现在问题中的字符(如|)分开,那么它就变得非常容易使用了。将文件的第一行设为问题数。

AS far as the arrays go, I'd store the questions and answers in a file - to make them a lot easier to edit. If you store them as one question and answers per line, and separate them with a character that can't be in the question or answers such as '|' then it becomes really easy to work with. Make the first line of the file the number of questions.
Question|CorrectAnswerNumber|First answer|Second answer|Third answer

例如:

For example:

2
What colour is a banana?|2|Blue|Yellow|Green
Which is the odd one out?|3|Tomato|Apple|Lettuce

在您的代码中,创建一个反映每个问题和答案集的结构,并包括问答指针,正确的答案编号和学生答案。

然后编写一个函数,它接受一行文本和指向结构的指针,并填充它。

读取文件并获取问题的数量,然后创建一个结构数组值的数量。读取循环中的每一行,使用该函数进行转换。

该数组易于使用,您可以使用该数组在最后计算学生最终标记,通过查看他们给出的答案编号。



有意义吗?

In your code, create a struct which reflects each question and answer set, and includes question and answer pointers, the correct answer number, and the student answer.
Then write a function which takes a line of text and a pointer to a struct and fwhich fills it in.
Read the file and get the number of questions, then create an array of the struct with that number of values. Read each of the lines in a loop, use the function to convert it.
The array is then easy to use, and you can use the array to work out the student final mark at the end, just by looking through at the answer number they gave.

Make sense?


这篇关于坚持实施多项选择计划的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆