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
|
#include "stdafx.h"
int _tmain(int argc, _TCHAR* argv[])
{
int matches = 0,
num1,
num2,
i = 0,
arrayReference1 = 0,
arrayReference2 = 0;
int firstArray[] = {11, 22, 33, 44, 55, 66, 77, 88, 99, 0};
int secondArray[] = {1, 22, 3, 44, 5, 66, 7, 88, 9, 10};
while (i <= 9, i++)
{
num1 = firstArray[arrayReference1];
num2 = secondArray[arrayReference2];
if (num1 == num2)
{
matches++;
arrayReference1++;
}
else
arrayReference2++;
}
cout << "You have this many matches: " << matches;
cout << endl;
system("PAUSE");
return 0;
}
|