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 32 33 34 35 36 37 38 39 40 41
|
#include <iostream>
using namespace std;
int const arraySize = 10;
int myArray[arraySize] = {0,0,0,0,1,0,0,0,0,0};
int myArray2[arraySize] = {1,2,3,4,5,6,0,8,9,0};
class test
{
public:
void testZero( int i) //Test if the array equals zero.
{
for (int i = arraySize - 1; i >=0; i--)
{
if (myArray[i] == 0)
{
cout << "True" << endl;
}
else
{
cout << "False" << endl;
}
}
}
};
int main()
{
test myTest;
int forLoop;
myTest.testZero(forLoop);
return 0;
}
|