Commit ec4c6a1f authored by Eddy Marinez's avatar Eddy Marinez

Merge branch 'master' of gitlab.cs.wallawalla.edu:sextja/cptr142_group_project

parents 7dfffad1 cba7cbc5
...@@ -11,10 +11,10 @@ using namespace std; ...@@ -11,10 +11,10 @@ using namespace std;
int main() { int main() {
Questions questionList; Questions questionList;
questionList.addSubQuestion(7); for(int i = 1; i <= 10; i++ ) {
questionList.addSubQuestion(7); questionList. mainQuestionAsk(i);
questionList.addSubQuestion(7); cout << "Level Up!\n";
questionList.addSubQuestion(7); }
return 0; return 0;
} }
\ No newline at end of file
...@@ -10,15 +10,20 @@ ...@@ -10,15 +10,20 @@
#include <ctime> // For time(0) #include <ctime> // For time(0)
using namespace std; using namespace std;
void Questions::mainQuestionAsk(int level) { bool Questions::mainQuestionAsk(int level) {
if((level >= 1) && (level <= 3)) {
} return countingQuestion(level);
}
int Questions::determineQuestion(int level) { else if ((level >= 4) && (level <= 10)) {
return 0; return addSubQuestion(level);
}
else {
return wordQuestion(level);
}
} }
bool Questions::countingQuestion(int level) { bool Questions::countingQuestion(int level) {
srand(time(0));
int countTo; int countTo;
switch(level) { switch(level) {
case 1: case 1:
...@@ -32,9 +37,11 @@ bool Questions::countingQuestion(int level) { ...@@ -32,9 +37,11 @@ bool Questions::countingQuestion(int level) {
break; break;
default: default:
cerr << "Please see your teacher about your current level."; cerr << "Please see your teacher about your current level.";
return false;
break; break;
} }
int answer; int answer;
countTo++; //To set the possible range to 1 -> maximum, instead of 0 -> (maximum -1)
for(int i = 0; i < countTo; i++) { for(int i = 0; i < countTo; i++) {
if(countTo % 2 == 0) if(countTo % 2 == 0)
cout << "X "; cout << "X ";
...@@ -83,6 +90,7 @@ bool Questions::addSubQuestion(int level) { ...@@ -83,6 +90,7 @@ bool Questions::addSubQuestion(int level) {
break; break;
default: default:
cerr << "Please see your teacher about your current level.\n"; cerr << "Please see your teacher about your current level.\n";
return false;
break; break;
} }
...@@ -138,5 +146,6 @@ bool Questions::addSubQuestion(int level) { ...@@ -138,5 +146,6 @@ bool Questions::addSubQuestion(int level) {
} }
bool Questions::wordQuestion(int level) { bool Questions::wordQuestion(int level) {
cout << "Question type not configured.";
return false;
} }
\ No newline at end of file
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
Question class header file Question class header file
Jared Sexton Jared Sexton
============================================================================ ============================================================================
Currently, questions are configured for levels 1 through 10.
*/ */
...@@ -10,9 +11,9 @@ ...@@ -10,9 +11,9 @@
class Questions { class Questions {
public: public:
void mainQuestionAsk(int level); // Asks the proper question based on the player's level.
// It returns true if they answered correctly, and false if not.
int determineQuestion(int level); bool mainQuestionAsk(int level);
// Asks a question, returns true if the kid was right, false if they were wrong. // Asks a question, returns true if the kid was right, false if they were wrong.
bool countingQuestion(int level); bool countingQuestion(int level);
......
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