First i wanted to say thanks to the ones who help me with my first thread :-)
i was able to get that program running with some more coding.
now w.the problem i have.
Iam trying to write a multiplication program that will help my kids memorize his time table.
As a new coder i keep getting these errors about " local variable 'num2' used without having been initialized" i thought i did can any one point me in the right direction. i have attach the whole program, if i'm not initializing at the right place then where should it be. i have the book called "STARTING OUT WITH C++ 4th ed." i read thee chapther about the loops and while /do while/for loops and i guess i mess something up.. any help would be great.
#include <cstdlib> //for rand numbers
#include <ctime> //for srand numbers
#include <iostream> //for all programs
using namespace std;
int main()
{
int j; // this will int these variables
int k;
int num1;
int num2;
int product;
int answer;
int correctAnswer; // this will int these variables
cout << "Welcome to the Times Table Tutor!";
cout << endl;
cout << "This program will help you learn the multiplication tables.";
cout << endl;
cout << "You will have to answer 10 question correctly before the program will end.";
cout << endl;
for (num1 = 0; num2 <=10; num1++)
{
srand((unsigned)time(0));
j = 0 + rand() % 12;
k = 0 + rand() % 12;
cout << num1 * num2;
product = num1 * num2;
cin >> answer;
cout << " Way to go, keep up the good work!";
while ( !(correctAnswer == answer)) // ask for the right answer
{
cout << "WRONG, Lets try it again";
cin >> answer;
}
cout << "Yea, your correct, I knew you could do it!"; // this should keep the loop going to complete the program
}
char userInput;
cin >> userInput;
return 0;
}
error 1=warning C4700: local variable 'num2' used without having been initialized
error2=warning C4700: local variable 'correctAnswer' used without having been initialized
thanks for all that help