#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2003
    Location
    house
    Posts
    2
    Rep Power
    0

    Question problem in displaying the corret and wrong answer in a c program


    hi:D !

    please help me in making a program that will display the correct and wrong answer in 10 simple math problem .


    example is :

    prob1=answer(correct)
    probb2=answer(wrong)....


    no. of correct:5
    no. of wrong:5

    note the user will answer the problem!


    thank you !
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Beginner (1000 - 1499 posts)

    Join Date
    Feb 2001
    Posts
    1,481
    Rep Power
    15
    1) put the correct answers in an array called something like "key"

    2) read in the user's answers into an array called "answers"

    3) use a for loop to step through the key array and check if key[i] == answer[i]. if it does increment a variable called correct by one, if not increment a variable called wrong by one.

    4) When the for loop ends display the variable correct and the variable wrong.
    Last edited by 7stud; August 1st, 2003 at 03:17 AM.

IMN logo majestic logo threadwatch logo seochat tools logo