for loop problem

My for loop incrementation seems to be ignoring the if statements rule, and incrementing every time, rather than just when the numbers are equal

here is the code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#include <iostream> /*Allows inputs and outputs to be made within the program*/

using namespace std; /*Activates the standard controls within the program*/

char g; /*Declares the g variable as char*/
int billy [5] = {1,2,3,4,5}; /*Declares the first array and sets the number of slots and whats in those slots*/
int chilli [5] = {5,4,3,2,1}; /*Declares the second array and sets the number of slows and whats in those slots*/
int total = 0; /*Declares the total variable and sets the default value*/

int main () /*First line that gets executed*/
{

    for (int j=0; j<5; ++j)
    {

        for (int i=0; i<5; ++i)
        {

            if (billy[i] == chilli[j]);
            {
                ++total;
            }

        }

    }

    cout << total << " Numbers(s) are the same"; /*Displays the amount of numbers that were the same in both arrays*/
    cin >> g; /*Closes the program when the user enters any character*/
    return 0; /*Terminates the program*/
}

ignore the notes, just reminders to myself
Last edited on
You've got a semi-colon at the end of line 19, take it off
of course!!!! i am kicking myself, thank you
Topic archived. No new replies allowed.