Math in program not working right

Hello, I've just updated my quiz program of which I had started to code yesterday. I added a new question, so now there are a total of 16 questions. At the end of my program, I made the following to calculate the percentage of the score the user got on the quiz:

percent = score * 100.0 / 16;

Each time the user answers a question correctly, 1 point is added to the integer "score". When I had only 15 questions, the program was working as I expected. The problem is, whenever I answer all the questions right, at the end, when it tells the user their score and percentage, I get a percentage of 93% and a fraction of 15/16. I know for a fact that I am answered all the questions right. I repeated the quiz several times to find out if I had just made an error typing the answer, but it doesn't seem so.

The code is too long to post here, (max characters = 9000) therefore I uploaded it to PasteBin:

http://pastebin.com/XqktCBgw
I bet this is just a tiny problem where I just need to change one number or so, but anyway, I can't seem to find it :P
I found the problem.
Instead of q16 in the 16th question you used q15,so it doesn't give any points when you check in the If statement.
Anyways here it is.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
string q16 = "";
        cout << "Question 16/16:\nWhat is the name of the third book in the Hunger Games trilogy?\n\n"
             << "1 = Mockingbird\n2 = Catching Fire\n3 = Victors Village\n4 = Mockingjay\n5 = Rebellion"
             << "\n6 = Hasn't been released yet\n" <<endl;
        cin >> q16;
        cout << "\n" << endl;

        if (q16 == "4")
        {
            score += 1;
        }

        if (q16 == "exit")
        {
            cout << "Thanks for taking the quiz! Press Enter to exit\n";
            cin.ignore();
            cin.get();
            return 0;
        }
Thanks, I will try it! :) I knew it had to be something so small like that.
Yeah, it works fine now, thanks again.
Topic archived. No new replies allowed.