Write a program that administers a quiz

A

Ajoy K Thamattoor

BabyBoo24 said:
I must create ten multiple choice questions.The questions will be weighted
Question1: 10.0 points question2: 15.0 points, etc. Each question has
different weights. The weights must be defined as constants. After the
user enters an answer the program must go to the next question. At the
end of the program I need to output the number of questions answered
correctly, a letter and numerical grade. How do I store the users answer
and calculate the numerical grade? Please Help Asap

First you need to choose your data structure. You'll need one
which can store:
The question
The weight
The real answer
The user's answer
Once you have this, use the C I/O functions to display the
questions, and get the answers. At the end, run through the data
structure and use a comparison function (probably
based on a C string comparison function) to determine if the answer
is correct. Accumulate the number of correct answers and calculate the
numerical grade and letter grade according to the grading formula.

Ajoy
 
B

BabyBoo24

I must create ten multiple choice questions.The questions will be weighted
Question1: 10.0 points question2: 15.0 points, etc. Each question has
different weights. The weights must be defined as constants. After the
user enters an answer the program must go to the next question. At the
end of the program I need to output the number of questions answered
correctly, a letter and numerical grade. How do I store the users answer
and calculate the numerical grade? Please Help Asap
 
K

Keith Thompson

BabyBoo24 said:
I must create ten multiple choice questions.The questions will be weighted
Question1: 10.0 points question2: 15.0 points, etc. Each question has
different weights. The weights must be defined as constants. After the
user enters an answer the program must go to the next question. At the
end of the program I need to output the number of questions answered
correctly, a letter and numerical grade. How do I store the users answer
and calculate the numerical grade? Please Help Asap

If you're not even going to *try* to do this yourself, don't expect
much help here.

You haven't asked a question about the C programming language, which
is what we discuss here.
 
C

CBFalconer

BabyBoo24 said:
I must create ten multiple choice questions.The questions will be
weighted Question1: 10.0 points question2: 15.0 points, etc. Each
question has different weights. The weights must be defined as
constants. After the user enters an answer the program must go
to the next question. At the end of the program I need to output
the number of questions answered correctly, a letter and numerical
grade. How do I store the users answer and calculate the numerical
grade? Please Help Asap

We are happy to do your homework here. We charge USD 200 per
hour. You will have to supply the questions and weights. We can
handle your problem, in portable standard C, with no more than two
hours effort, and will start as soon as we receive your certified
check for $400. Delivery will be made by e-mail within 48 hours of
clearance of your check.

If you supply the e-mail address of your instructor we will also
deliver the result there directly, at no extra charge.

We guarantee the program quality to be such as to deserve an 'A'
marking. However, since your instructor does not report to us, we
cannot guarantee your actually receiving such a mark. We will be
available, at our standard hourly rates plus expenses, to give
testimony should a dispute over your mark arise.
 
O

osmium

BabyBoo24 said:
I must create ten multiple choice questions.The questions will be weighted
Question1: 10.0 points question2: 15.0 points, etc. Each question has
different weights. The weights must be defined as constants. After the
user enters an answer the program must go to the next question. At the
end of the program I need to output the number of questions answered
correctly, a letter and numerical grade. How do I store the users answer
and calculate the numerical grade? Please Help Asap

The assignment isn't specific but from the examples given it sounds as
though the total weight of all the questions is 100. So you would simply
sum the weights of all the correct answers. If this be so and if you had

int sum = 0;

and added to it as appropriate you would end up with the numerical grade.
The number answered correctly would involve a different variable.
 
T

Thomas Matthews

BabyBoo24 said:
I must create ten multiple choice questions.The questions will be weighted
Question1: 10.0 points question2: 15.0 points, etc. Each question has
different weights. The weights must be defined as constants. After the
user enters an answer the program must go to the next question. At the
end of the program I need to output the number of questions answered
correctly, a letter and numerical grade. How do I store the users answer
and calculate the numerical grade? Please Help Asap

Big Hint: structures.

structure:
Text of question
Weight of question (or value)

Hint: use an array of constant structures.

Hint: use a variable to keep track of the score.

Hint: Talk to instructor first about assignments
before posting here.

--
Thomas Matthews

C++ newsgroup welcome message:
http://www.slack.net/~shiva/welcome.txt
C++ Faq: http://www.parashift.com/c++-faq-lite
C Faq: http://www.eskimo.com/~scs/c-faq/top.html
alt.comp.lang.learn.c-c++ faq:
http://www.comeaucomputing.com/learn/faq/
Other sites:
http://www.josuttis.com -- C++ STL Library book
http://www.sgi.com/tech/stl -- Standard Template Library
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,774
Messages
2,569,599
Members
45,173
Latest member
GeraldReund
Top