dcsimg


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 8 of 8

Thread: I'm going to need help in figuring out how to implement this functionality

  1. #1
    Join Date
    Sep 2019
    Posts
    11

    I'm going to need help in figuring out how to implement this functionality

    Most of my programming over the years has been console apps. The kind you see in books. But now I want to start writing some Windows based programs. I wish to write a Psychology Test intended for fun for myself and a few others that are interested in the topic. The test will consist of 8 multiple choice questions. There will be 4 possible answers to choose from. I think I know how I would do the logic for the basics of keeping track of how many correct answers the user has so far, and I think I know how to change the question and the possible answers when the user presses the Next button.

    But I would like to add some more functionality to it.

    It would be cool if at the end of the test the user could press a Review button and the program would take him back or show him which specific questions he got wrong. And I would need to show what the correct answer to that question is.

    I don't know how this would be implemented.

    If you can post some pointers for me that would be appreciated. This is completely new ground for me.

    I'm tentatively planning on using C++ Builder for this.

  2. #2
    Join Date
    Jan 2018
    Posts
    23
    I don't use C++ Builder so can't comment on that - or its graphics components. However, the first basic question is - are the questions/answers going to be hard-coded into the program, or held in a file so that they can be easily changed without altering/re-compiling the program.

    For the questions etc, you have a structure that holds the question, the possible answers, the correct answer (no?) and the user answer (no or no answer) for backtracking/review. You then need a container to hold this structure for each question - possibly a vector. So Next is simply a matter of iterating forward through the container and Previous would iterate back. The display would show the info relating to the current position (iterator) in the container.

    Review is effectively the same as starting at the beginning and doing Next except that the correct answer is shown if different from that entered and a score displayed.

  3. #3
    Join Date
    Sep 2019
    Posts
    11
    I was thinking about hard coding the questions in a label. Since you can put text in a label that's where I thought the question would go. I'm not planning on changing the questions. I don't know what you mean by a structure. I don't know what a vector is. I don't know what a container is either.

  4. #4
    Join Date
    Jan 2018
    Posts
    23
    What is your level of C++ knowledge?

  5. #5
    Join Date
    Sep 2019
    Posts
    11
    I have covered Variables, Arrays, Loops, Control Structures. Never went into the chapter on Vectors.

  6. #6
    Join Date
    Jan 2018
    Posts
    23
    Ah - very basic. How are you learning c++? For an on-line tutorial, consider https://www.learncpp.com/

    Often, when learning c++ you start with console programs because reading/writing using console is part of the C++ language. Using windows for gui programs is not part of the C++ language. You have to use 3rd party libraries. There are various ones available. The most basic is WIN32 which is a set of API functions from Microsoft (Windows SDK) that provides low-level gui functions. Then there are various frameworks and libraries. Borland has its Object Windows/controls etc, Microsoft MFC then there's x-platform frameworks such as QT, FLTK etc. In every case, as well as having to know C++ pretty well you also have to become familiar with the library/framework being used. In particular, except for WIN32 you need a good working knowledge of C++ classes - which you haven't yet covered.

    Based upon what you are attempting, I would suggest you get a copy of the book 'Programming: Principles and Practice Using C++' by Bjarne Stroustrup (inventor of he C++ language) https://www.amazon.co.uk/Programming...s%2C164&sr=1-3 Not only does this give a good grounding in C++ but introduces the FLTK graphics framework (with useful examples) so that gui programs can be developed.

  7. #7
    Join Date
    Sep 2019
    Posts
    11
    I have done some introductory work with Classes also. You don't need all that do write a Psychology Test. C++ Builder is a visual environment. It's just like Visual Basic but it's for the C++ language. It's visual. You start with a form and drop GUI components on the form to build your program. It's a Rapid Application Environment like Visual Basic is. I don't need all that stuff you mentioned to build my program.

    What I need to learn is how to implement this go back to the question you got wrong functionality.

  8. #8
    Join Date
    Jan 2018
    Posts
    23
    As I mentioned in post#2, I don't use and don't know C++ Builder - so can't help you on specifics of using its visual environment to build gui c++ programs.

    Perhaps another who has knowledge/experience of C++ Builder can provide specific advice?

Similar Threads

  1. Replies: 11
    Last Post: 05-06-2006, 02:06 AM
  2. Replies: 0
    Last Post: 01-30-2006, 07:24 PM
  3. Why use CDECL? / Figuring DLL API calls!
    By Mark Alexander Bertenshaw in forum VB Classic
    Replies: 20
    Last Post: 05-16-2001, 08:09 AM
  4. Why use CDECL? / Figuring DLL API calls!
    By Mark Alexander Bertenshaw in forum VB Classic
    Replies: 0
    Last Post: 05-14-2001, 08:32 AM
  5. Figuring Things Out
    By Jonathan Wood in forum .NET
    Replies: 11
    Last Post: 12-25-2000, 12:49 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center