Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Making an adaptive studying application [modified]

Making an adaptive studying application [modified]

Scheduled Pinned Locked Moved C / C++ / MFC
questionhelptutorialdiscussion
10 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    rbwest86
    wrote on last edited by
    #1

    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

    _ 1 Reply Last reply
    0
    • R rbwest86

      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

      _ Offline
      _ Offline
      _Superman_
      wrote on last edited by
      #2

      CAT[^]

      «_Superman_» I love work. It gives me something to do between weekends.
      Microsoft MVP (Visual C++)

      R 1 Reply Last reply
      0
      • _ _Superman_

        CAT[^]

        «_Superman_» I love work. It gives me something to do between weekends.
        Microsoft MVP (Visual C++)

        R Offline
        R Offline
        rbwest86
        wrote on last edited by
        #3

        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.

        _ 1 Reply Last reply
        0
        • R rbwest86

          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.

          _ Offline
          _ Offline
          _Superman_
          wrote on last edited by
          #4

          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++)

          R 1 Reply Last reply
          0
          • _ _Superman_

            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++)

            R Offline
            R Offline
            rbwest86
            wrote on last edited by
            #5

            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 ;

            _ 1 Reply Last reply
            0
            • R rbwest86

              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 ;

              _ Offline
              _ Offline
              _Superman_
              wrote on last edited by
              #6

              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++)

              R 1 Reply Last reply
              0
              • _ _Superman_

                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++)

                R Offline
                R Offline
                rbwest86
                wrote on last edited by
                #7

                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?

                _ 1 Reply Last reply
                0
                • R rbwest86

                  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?

                  _ Offline
                  _ Offline
                  _Superman_
                  wrote on last edited by
                  #8

                  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++)

                  R 1 Reply Last reply
                  0
                  • _ _Superman_

                    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++)

                    R Offline
                    R Offline
                    rbwest86
                    wrote on last edited by
                    #9

                    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.

                    R 1 Reply Last reply
                    0
                    • R rbwest86

                      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.

                      R Offline
                      R Offline
                      rbwest86
                      wrote on last edited by
                      #10

                      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

                      1 Reply Last reply
                      0
                      Reply
                      • Reply as topic
                      Log in to reply
                      • Oldest to Newest
                      • Newest to Oldest
                      • Most Votes


                      • Login

                      • Don't have an account? Register

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • World
                      • Users
                      • Groups