Question: C++. Please include include screenshots and code to copy and paste. Please use good spacing in the code. Thank you. The purpose of the third

C++. Please include include screenshots and code to copy and paste. Please use good spacing in the code. Thank you.

The purpose of the third program is to refine our ability to create functions with arguments in C++ and practice using arrays of characters, structures, and external data files. Again, our goal is to create programs with small functions where main delegates to a series of functions where the real work takes place.

  1. No global variables (global constants are fine).
  2. Avoid using break within a loop (unless working with a switch statement).
  3. Never use a return in the middle of a loop!
  4. You may not use the string class instead use arrays of characters.
    1. You are allowed to use the cstring library.
    2. You are encouraged to use strcmp and strlen in this assignment.
  5. Limit the length of your functions to no more than 30 statements of code (not including comments, blank lines, or variable definitions).

For this programming assignment, build external data files of practice questions related to a particular topic. We will want one file for each of the following concepts: Conditionals, Loops, Functions, and Structures. These files should be named: conditionals.txt, loops.txt, functions.txt, and structs.txt.

With each practice question, categorize that question (such as a question that has you sum 5 numbers together could be: Sum or Counter Controlled Loop) and rate the question on how difficult it is. They should be created on linux with this format with a colon placed in the file after each field:

Keyword:Difficulty Rating:Question

For example: Sum:Easy:Sum 5 numbers together using a loop.

Your job for program #3 is to build a program using structs to hold information about a practice question. Your program will need to create four different arrays of structs for each of the four types of questions we are creating (for example, Conditionals, Loops, Functions, and Structures). Each array of structures should hold up to 10 questions at most in memory.

Your program will need to read information from the four data files and store the information in these arrays to get started.*** You are not expected in this assignment to handle more than 10 questions per topic.

After this, your program should provide a simple text based menu to the user to ask them what they want to do. Their choices should be to display the information about a particular type of question (conditional, loop, function or structure), display just a particular level of question (just easy ones today), or add a new question to the list. The menu should allow the user to quit as well.

The functions you will need to have for this assignment, at a minimum, are:

  1. Display a Menu of Choices
  2. Load questions from a file
  3. Display all questions (up to 10 questions)
  4. Display all of a given level (up to 10 questions)
  5. Add a new question
  6. Save a new question to the end of a file

With these functions, think about what arguments you will need. Remember whenever the code is the same except for the variable you are working with, functions can be used with arguments to control this. This means to load from a file, you only need to write the code once and pass information to that function to control (a) what file is being read from and (b) what array you need to fill and receive back from the function the number of items read in.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!