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>
#include <cstring>
using namespace std;
bool isEqual(char arr_1[], char arr_2[], int size)
{
for(int i=0; i<size; i++)
{
if(arr_1[i] != arr_2[i])
return false;
}
return true;
}
int main()
{
srand(static_cast<unsigned int>(time(NULL)) );
char number[5] = {'1', '2', '3', '4', '5'};
char guess[5] = {'1', '2', '3', '4', '5'};
char new_guess[5] = {'1', '0', '3', '4', '5'};
cout << isEqual(number,guess,5);
cout << endl;
cout << isEqual(number, new_guess, 5);
cout << endl;
cin.ignore();
return 0;
}
|