Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
C
cptr142_group_project
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jared Sexton
cptr142_group_project
Commits
6fefa4b6
Commit
6fefa4b6
authored
Mar 01, 2018
by
Jared Sexton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update Questions
parent
ea663a41
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
58 additions
and
14 deletions
+58
-14
Question_driver.cpp
Question_driver.cpp
+4
-4
Questions.cpp
Questions.cpp
+50
-8
Questions.h
Questions.h
+4
-2
No files found.
Question_driver.cpp
View file @
6fefa4b6
...
...
@@ -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
Questions.cpp
View file @
6fefa4b6
...
...
@@ -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
Questions.h
View file @
6fefa4b6
...
...
@@ -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
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment