Thread: Help with comparing answer to math problem and user's answer

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User
    Join Date
    Jun 2012
    Posts
    9

    Help with comparing answer to math problem and user's answer

    Hi, I have to write a program where I give the user "p" random math problems, they decide how many by inputting p. I wrote the program using a for loop that gives them as many problems as they ask for, and ask them to input an answer for each one.

    The problem is I need to be able to write a code that calculates how many they got right and then gives a percentage. I have no idea how to do this and any pointers would be greatly appreciated. I calculate the answer to each problem as float "answer" and the user answer for each problem is float "user".

    here is my code so far:

    Help with comparing answer to math problem and user's answer-1034276-tzsmmhc-jpg
    Last edited by Jake Garbelotti; 06-22-2012 at 12:20 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Numbering questions that the user wants to answer.
    By KumarSingh in forum C Programming
    Replies: 7
    Last Post: 06-20-2012, 03:23 PM
  2. an answer raises another problem...
    By Dorky King in forum C Programming
    Replies: 2
    Last Post: 06-12-2007, 03:11 PM
  3. stupid problem. answer = 0.0
    By spydrvnm in forum C Programming
    Replies: 6
    Last Post: 09-26-2004, 10:53 AM
  4. problem with answer going to default?
    By Patrick1234 in forum C++ Programming
    Replies: 4
    Last Post: 10-02-2002, 09:11 AM
  5. slight problem just can't see the answer
    By anthonye in forum C++ Programming
    Replies: 1
    Last Post: 07-05-2002, 08:45 AM