
November 30th, 2012, 01:37 PM
|
|
Registered User
|
|
Join Date: Nov 2012
Posts: 1
Time spent in forums: 1 h 10 m
Reputation Power: 0
|
|
|
LNK2019 Error in C++
My code:
#include "stdafx.h"
#include <iostream>
#include <iomanip>
using namespace std;
bool testPIN(int, int, int);
int countMatches(int, int, int);
const int maxPINSize=10;
int databasePIN [maxPINSize];
int custPIN [maxPINSize];
int main()
{
int size=0;
cout << "\nPlease set your PIN by entering a number then pressing enter. When finished, enter a negative one.\nThere is a limit of 10 numbers per PIN.\n" ;
while (databasePIN[size] != -1 && size != 9)
{
cin >> databasePIN[size];
size++;
cout << "\nDigit " << size << "has been set to " << databasePIN[size-1] << "!\n";
}
cout << "\nPlease enter your PIN again to confirm.\n";
size=0;
while (custPIN[size] != -1 && size != 9)
{
cin >> custPIN[size];
size++;
cout << "\nDigit "<< size << "has been set to " << databasePIN[size-1] <<"!\n";
}
if (testPIN( custPIN [maxPINSize], databasePIN [maxPINSize], size)==true)
cout <<"\nYour PIN numbers match and it has been saved .";
else cout << "\nYour PIN numbers did not match. Please restart the program and try again.";
}
bool testPIN(int custPIN[maxPINSize], int databasePIN[maxPINSize], int size)
{
if ( countMatches(custPIN [maxPINSize], databasePIN [maxPINSize], size)==size)
return true;
else return false;
}
int countMatches( int custPIN[maxPINSize], int databasePIN[maxPINSize], int size)
{
int count=0;
for (int index = 0; index < size; index++)
{
if (custPIN[index] == databasePIN[index])
count++;
}
return count;
}
My errors:
1>ConsoleApplication6.obj : error LNK2019: unresolved external symbol "bool __cdecl testPIN(int,int,int)" (?testPIN@@YA_NHHH@Z) referenced in function _main
1>ConsoleApplication6.obj : error LNK2019: unresolved external symbol "int __cdecl countMatches(int,int,int)" (?countMatches@@YAHHHH@Z) referenced in function "bool __cdecl testPIN(int * const,int * const,int)" (?testPIN@@YA_NQAH0H@Z)
|