I wrote code for a computer asssisted instruction program for multiplication but every time I build and debug I get undeclared identifier errors. I cannot figure out why they are errors. Here is my code and the errors I receive. Please help.


#include<iostream>
#include<cstdlib>
using namespace std;

//function prototypes
void problemGeneration(int, int, int);
void checkAnswer(int&, int, bool);
//declare global variables to be passed into functions

int main()
{
int num1 = rand() % 10;//random number between 0 and 9
int num2 = rand() % 10;//random number between 0 and 9
int answer = 0;
int product = num1 * num2;
bool isCorrect = false;
problemGeneration(num1, num2, answer);
checkAnswer(answer, product, isCorrect);
}

void problemGeneration(int num1, int num2, int answer)
{
cout <<"How much is" << " "<< num1 <<" " <<"times" << num2 << "?" << endl;
cin >> answer;
}

void checkAnswer(int &answer, int product, bool isCorrect)
{

if(answer == product)
{
isCorrect = true;
if(isCorrect = true)
{
cout << "Very Good!"<< endl;
problemGeneration(num1, num2, answer);
}
}
else
{
isCorrect = false;
cout << "No. Please Try Again. " << endl;
cin>> answer;
}
}



1>c:\users\jason\documents\visual studio 2008\projects\computer-aided instruction\computer-aided instruction\computer-aided instruction.cpp(36) : error C2065: 'num1' : undeclared identifier
1>c:\users\jason\documents\visual studio 2008\projects\computer-aided instruction\computer-aided instruction\computer-aided instruction.cpp(36) : error C2065: 'num2' : undeclared identifier