Thread: I need some help with an assignment

  1. #1
    Registered User
    Join Date
    Feb 2005
    Posts
    9

    I need some help with an assignment

    I have to create a multiple answer quiz with 10 questions and each question is weighted differently. The quiz taker needs to be able to answer in upper and lower case letters.

    One question that I have is how do I keep up with the correct answer and weighted total throughout the entire program and then display it at the end?

  2. #2
    Registered User
    Join Date
    Feb 2005
    Posts
    9
    And thank you for any help.

  3. #3
    Slave MadCow257's Avatar
    Join Date
    Jan 2005
    Posts
    735
    and weighted total throughout the entire
    int currentscore = 0;
    change the value as needed
    how do I keep up with the correct answer
    If you know about strings and the tolower function this should be easy
    and then display it at the end?
    cout << currentscore << "\n";

  4. #4
    Registered User
    Join Date
    Apr 2003
    Posts
    2,663
    You could put the questions and answers into an array(or two arrays) and then use a for loop to output a question, read in the answer, compare it to the answer in the array, determine the weighted score, and add it to the total score.

  5. #5
    Registered User
    Join Date
    Feb 2005
    Posts
    9
    We haven't gotten into arrays yet. It reads we will need to use int, float, string, char.

  6. #6
    Handy Andy andyhunter's Avatar
    Join Date
    Dec 2004
    Posts
    540
    int currentscore = 0;
    change the value as needed
    Some psuedocode:

    initialize currentscore to 0
    ask a question
    input the answer and convert to one case (either upper or lower)
    compare with the correct answer
    if right add to currentscore the required amount of points
    if not dont add anything
    continue this block until all questions asked
    divide currentscore by total points possible
    Multiply result by either 4 (4.0 grading scale) or 100 (100% grading scale)
    end program
    i don't think most standard compilers support programmers with more than 4 red boxes - Misplaced

    It is my sacred duity to stand in the path of the flood of ignorance and blatant stupidity... - quzah

    Such pointless tricks ceased to be interesting or useful when we came down from the trees and started using higher level languages. - Salem

  7. #7
    Registered User
    Join Date
    Dec 2004
    Posts
    465
    I think if you know just a little bit of the language this shouldn't be hard for you. You just need to make a few simple math problems.
    My computer is awesome.

  8. #8
    Registered User
    Join Date
    Feb 2005
    Posts
    9
    Thanks for all of your help everyone I met all of the guidelines in the assignment.

  9. #9
    Registered User
    Join Date
    Feb 2005
    Posts
    9
    Yeah cerin that is what I did.

  10. #10
    Registered User
    Join Date
    Dec 2004
    Posts
    465
    PPPssstttt....... You probably could have edited your other post.
    My computer is awesome.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Menu
    By Krush in forum C Programming
    Replies: 17
    Last Post: 09-01-2009, 02:34 AM
  2. Assignment Operator, Memory and Scope
    By SevenThunders in forum C++ Programming
    Replies: 47
    Last Post: 03-31-2008, 06:22 AM
  3. Screwy Linker Error - VC2005
    By Tonto in forum C++ Programming
    Replies: 5
    Last Post: 06-19-2007, 02:39 PM
  4. Help with a pretty big C++ assignment
    By wakestudent988 in forum C++ Programming
    Replies: 1
    Last Post: 10-30-2006, 09:46 PM
  5. Replies: 1
    Last Post: 10-27-2006, 01:21 PM