Commit 6fefa4b6 authored by Jared Sexton's avatar Jared Sexton

Update Questions

parent ea663a41
......@@ -11,10 +11,10 @@ using namespace std;
int main() {
Questions questionList;
questionList.countingQuestion(2);
questionList.countingQuestion(2);
questionList.countingQuestion(2);
questionList.countingQuestion(2);
questionList.addSubQuestion(4);
questionList.addSubQuestion(4);
questionList.addSubQuestion(4);
questionList.addSubQuestion(4);
return 0;
}
\ No newline at end of file
......@@ -51,23 +51,66 @@ bool Questions::countingQuestion(int level) {
return false;
}
void Questions::addSubQuestion(int level) {
bool Questions::addSubQuestion(int level) {
int maxNumber;
switch(level) {
case 4:
maxNumber = rand() % 5;
case 4: // 5's
maxNumber = rand() % 4;
break;
case 5:
maxNumber = rand() % 10;
maxNumber = rand() % 5;
break;
case 6:
maxNumber = rand() % 20;
maxNumber = rand() % 6;
break;
case 7:
maxNumber = rand() % 7;
break;
case 8:
maxNumber = rand() % 8;
break;
case 9:
maxNumber = rand() % 9;
break;
case 10:
maxNumber = rand() % 10;
break;
default:
cerr << "Please see your teacher about your current level.";
cerr << "Please see your teacher about your current level.\n";
break;
}
// Initialize variables
int userAnswer, correctAnswer;
int term1, term2;
bool add = true;
// Make sure term1 is greater than term2 within the desired range.
do {
term1 = (rand() % maxNumber) + 1;
term2 = (rand() % maxNumber) + 1;
} while(term1 < term2);
// Determine if addition or subtraction
// if((term1 + term2) < (maxNumber / 2)) {
// add = false;
// }
// NOT WORKING
if(add) {
correctAnswer = term1 + term2;
cout << "\t" << term1 << endl;
cout << "+\t" << term2 << endl;
cout << "-----------" << endl;
cout << "\t";
cin >> userAnswer;
}
else {
correctAnswer = term1 - term2;
cout << "\t" << term1 << endl;
cout << "-\t" << term2 << endl;
cout << "-----------" << endl;
cout << "\t";
cin >> userAnswer;
}
if(userAnswer == correctAnswer) {
cout << "Good job!\n";
......@@ -78,7 +121,6 @@ void Questions::addSubQuestion(int level) {
return false;
}
void Questions::wordQuestion(int level) {
bool Questions::wordQuestion(int level) {
}
\ No newline at end of file
......@@ -17,9 +17,11 @@ class Questions {
// Asks a question, returns true if the kid was right, false if they were wrong.
bool countingQuestion(int level);
void addSubQuestion(int level);
// Asks a question, returns true if the kid was right, false if they were wrong.
bool addSubQuestion(int level);
void wordQuestion(int level);
// Asks a question, returns true if the kid was right, false if they were wrong.
bool wordQuestion(int level);
};
#endif //QUESTIONS_H
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment