Making an adaptive studying application [modified]
-
Hello all, I am trying to figure out how to make an adaptive program, which asks questions and if you get it wrong, it will ask you another question in that area. I know this will utilize arrays but I am just asking for some guidence on if I should use looping statements or write the whole thing out. Thoughts on where to start? "EDIT: The source is on the 9'th reply to this thread. Please read it to help me out." V/R Rob
modified on Thursday, January 28, 2010 10:25 AM
-
Hello all, I am trying to figure out how to make an adaptive program, which asks questions and if you get it wrong, it will ask you another question in that area. I know this will utilize arrays but I am just asking for some guidence on if I should use looping statements or write the whole thing out. Thoughts on where to start? "EDIT: The source is on the 9'th reply to this thread. Please read it to help me out." V/R Rob
modified on Thursday, January 28, 2010 10:25 AM
«_Superman_» I love work. It gives me something to do between weekends.
Microsoft MVP (Visual C++) -
«_Superman_» I love work. It gives me something to do between weekends.
Microsoft MVP (Visual C++)thank you very much, I am reading that now. Now I have a question. I have the program ask the question "What is the answer to this queston?" It then reads the users input, and checks if the answer was correct. If the answer was correct, it will continue. The problem it reads the user input and checks it with the answer, the program exits. I think the problem is its not clearing the user input for the next question.
-
thank you very much, I am reading that now. Now I have a question. I have the program ask the question "What is the answer to this queston?" It then reads the users input, and checks if the answer was correct. If the answer was correct, it will continue. The problem it reads the user input and checks it with the answer, the program exits. I think the problem is its not clearing the user input for the next question.
It would help if you can post the relevant portion of your code.
«_Superman_» I love work. It gives me something to do between weekends.
Microsoft MVP (Visual C++) -
It would help if you can post the relevant portion of your code.
«_Superman_» I love work. It gives me something to do between weekends.
Microsoft MVP (Visual C++)here you go:
// Chapter One
chapterone:
system("cls");
cout << "Fill in the blank." << endl;
cout << "Loosely defined, a ____ is a group of computers and other devices (such as printers) that are connected by some type of transmission media." << endl;
cout << "A.)Network " " B.)Router " " C.)Switch " " D.)Internet " << endl;
cin >> userinput ;// Start If Statement
if (userinput == B,b,C,c,D,d)
cout << "Sorry, that was a wrong answer." << endl;
else
cout << "Congradulations, your answer is correct!" << endl;system("cls");
cout << "Fill in the blank." << endl;
cout << "Loosely defined, a ____ is a group of computers and other devices (such as printers) that are connected by some type of transmission media." << endl;
cout << "A.)Network " " B.)Router " " C.)Switch " " D.)Internet " << endl;
cin >> userinput ; -
here you go:
// Chapter One
chapterone:
system("cls");
cout << "Fill in the blank." << endl;
cout << "Loosely defined, a ____ is a group of computers and other devices (such as printers) that are connected by some type of transmission media." << endl;
cout << "A.)Network " " B.)Router " " C.)Switch " " D.)Internet " << endl;
cin >> userinput ;// Start If Statement
if (userinput == B,b,C,c,D,d)
cout << "Sorry, that was a wrong answer." << endl;
else
cout << "Congradulations, your answer is correct!" << endl;system("cls");
cout << "Fill in the blank." << endl;
cout << "Loosely defined, a ____ is a group of computers and other devices (such as printers) that are connected by some type of transmission media." << endl;
cout << "A.)Network " " B.)Router " " C.)Switch " " D.)Internet " << endl;
cin >> userinput ;What is the data type of
userinput
.rbwest86 wrote:
if (userinput == B,b,C,c,D,d)
This statement is wrong. It should be -
if (userinput == B || userinput == b || userinput == C || userinput == c || userinput == D || userinput == d)
«_Superman_» I love work. It gives me something to do between weekends.
Microsoft MVP (Visual C++) -
What is the data type of
userinput
.rbwest86 wrote:
if (userinput == B,b,C,c,D,d)
This statement is wrong. It should be -
if (userinput == B || userinput == b || userinput == C || userinput == c || userinput == D || userinput == d)
«_Superman_» I love work. It gives me something to do between weekends.
Microsoft MVP (Visual C++)thank you for helping me with a lot of my syntax problems. I am still learning C++ obviously. Now another question I have is how to limit the users input to just A-D. If you put in 0 the program buggs out. So how can I implement more controls in my program? A separate note is how to make the program progress correctly. If you get it wrong, I need it to count the questions wrong along with the correct questions and display the results at the end. Do I need to associate userinput with correct and wrong strings?
-
thank you for helping me with a lot of my syntax problems. I am still learning C++ obviously. Now another question I have is how to limit the users input to just A-D. If you put in 0 the program buggs out. So how can I implement more controls in my program? A separate note is how to make the program progress correctly. If you get it wrong, I need it to count the questions wrong along with the correct questions and display the results at the end. Do I need to associate userinput with correct and wrong strings?
I guess you need to learn more on the C++ streams. Here is a link - http://www.it.uom.gr/teaching/deitel/chtp3e15to23ppt/C_chap21.ppt[^]
«_Superman_» I love work. It gives me something to do between weekends.
Microsoft MVP (Visual C++) -
I guess you need to learn more on the C++ streams. Here is a link - http://www.it.uom.gr/teaching/deitel/chtp3e15to23ppt/C_chap21.ppt[^]
«_Superman_» I love work. It gives me something to do between weekends.
Microsoft MVP (Visual C++)K I just got done reading that power point file you sent me. Now after reading it I think I need to "flush" the stream? so I should include a cin.clear() ? Im a little confused. Because I need to store the amount of correct answers, and the amount of incorrect answers. I will mess with it more in the morning.
-
K I just got done reading that power point file you sent me. Now after reading it I think I need to "flush" the stream? so I should include a cin.clear() ? Im a little confused. Because I need to store the amount of correct answers, and the amount of incorrect answers. I will mess with it more in the morning.
Ok, this is what I have so far:
// Robs N+ test question overview
#include <iostream>
#include <string>using namespace std;
int main()
{// Local Variables
int userinput;
int inputcounter = -1;
int correctanswer;
int wronganswer;
int choice;
int A,a,B,b,C,c,D,d;// Welcome Message
cout << "Roberts Network+ Test Questions" << endl;
cout << endl;
cout << endl;
cout << "Please Select a Chapter:" << endl;
cout << "Chapter One = 1" << endl;
cout << "Chapter Two = 2" << endl;
cout << "Chapter Three = 3" << endl;
cout << "Chapter Four = 4" << endl;
cout << "Chapter Five = 5" << endl;
cout << "Chapter Six = 6" << endl;
cout << "Chapter Seven = 7" << endl;
cout << "Chapter Eight = 8" << endl;
cout << "Chapter Nine = 9" << endl;
cout << "Chapter Ten = 10" << endl;
cout << "Chapter Eleven = 11" << endl;
cout << "Chapter Twelve = 12" << endl;
cout << "Chapter Thirteen = 13" << endl;
cout << "Chapter Fourteen = 14" << endl;
cout << "Chapter Fifteen = 15" << endl;
cout << endl;
cin >> choice;// START SWITCH
switch (choice)
{
case 1: goto chapterone;
break;
case 2: goto chaptertwo;
break;
case 3: goto chapterthree;
break;
case 4: goto chapterfour;
break;
case 5: goto chapterfive;
break;
case 6: goto chaptersix;
break;
case 7: goto chapterseven;
break;
case 8: goto chaptereight;
break;
case 9: goto chapternine;
break;
case 10: goto chapterten;
break;
case 11: goto chaptereleven;
break;
case 12: goto chaptertwelve;
break;
case 13: goto chapterthirteen;
break;
case 14: goto chapterfourteen;
break;
case 15: goto chapterfifteen;
break;
default: cout << "Error, invalid entry." << endl;
}// Start While
while (inputcounter <= 20)
{
// Chapter One
chapterone:
system("cls");
// Question 1
cout << "Fill in the blank." << endl;
cout << "Loosely defined, a ____ is a group of computers and other devices (such as printers) that are connected by some type of transmission media." << endl;
cout << "A.)Network " " B.)Router " " C.)Switch " " D.)Internet " << endl;
cin >> userinput, inputcounter ;
++inputcounter ;// Start If Statement
if (userinput == B || userinput == b || userinput == C || userinput == c || userinput == D || userinput == d