Here is the code I have to compare two arrays, one that is already set and one that a user inputs data into, the problem I get is that when I try to run it I get the following error:
Error 2 error C2664: 'arrayComp' : cannot convert parameter 2 from 'int' to 'int []' c:\users\jainish\documents\visual studio 2008\projects\team programming 2\team programming 2\team programming 2.cpp 18
Here is the code I have so far:
#include <cstdlib>
#include <iostream>
using namespace std;
bool arrayComp(int firstArr[], int secondArr[], int size);
void pinEnter(int secondArr[], int size);
bool arrayEqual = true;
int main()
{
const int size = 7;
int firstArr[7] = {3,6,8,4,5,8,7};
int secondArr;
pinEnter(secondArr, size);
bool equal = arrayComp(firstArr, secondArr, size);
system("PAUSE");
return EXIT_SUCCESS;
}
bool arrayComp(int firstArr[], int secondArr[], int size)
{
for(int i = 0; i < size; i++)
{
if(firstArr[i] != secondArr[i])
{
arrayEqual = false;
break;
cout << "You have entered a wrong PIN!";
}
return arrayEqual;
cout << "Welcome to The National Commerce Bank!";
}
}
void pinEnter(int secondArr[], int size)
{
for(int i = 0; i < size; i++)
{
cout << "Enter Your PIN: ";
cin >> secondArr[i];
}
}