I'm trying to write a simple program that checks the data in an array and tells me how many even values I have, this is what I have so far. When I run the program how it is currently written it continues to count up without end. Any help would be great.
Why are you declaring a two dimensional array but initializing it with a one dimensional array? Do you want to check an array with two dimensions or one dimension?
Also- I haven't run the code myself but I doubt you need a triple nested for loop to search an array with only two dimensions.
I'm thinking the correct way to get this done is a if statement, but it still isn't doing what I want. it is still just counting up from 0 to 5 here is my if statement.
1 2 3 4 5
if (A[B][C]%2 == 0)
{
D++;
}
cout <<"There are "<< D <<" even numbers"<< '\n';