Download the zipped project file [url removed, login to view] from the Homework Assignments area of Blackboard. The file contains a project file Homework [url removed, login to view], an implementation file flash.h for the flash class, and an application file flashapp.cpp.
Define the member functions to work with a list of flash cards for doing arithmetic. Here are the declarations:
int n1, n2, // values on flash card
answer; // answer to flash card
char op; // operator (*, +, -, / or %)
card* next; // pointer to the next card
typedef card* card_ptr;
void add_problem ();
void remove_problem ();
void print ();
void quiz ();
The member functions to be defined are:
flash: constructor that creates an empty flash card list.
add_problem: Adds a problem to the end of the list (not to the front). It should prompt the user for the equation to solve (example: 8 + 2). The function should create a node, place in the private data for the node, including the answer which it must compute, and insert it at the end of the list. / and % perform integer arithmetic. An indication that a problem has been added should be printed.
remove_problem: Removes the last problem in the list. If there are no problems in the list, an error message should be printed. The removed node should be recycled. An indication that a problem has been removed should be printed.
print: Prints the problems in the list. They should be printed one per line, in equation form and should include the answers. If there are no problems to print, an error message should be printed.
quiz: Presents each problem in turn to the user. For example:
6 * 2 =
quiz indicates for each problem whether the user correctly answered it. When the user enters a wrong answer, the correct answer should be given. quiz should keep a tally of the number of problems correctly answered. It should print the number of problems correctly answered out of the total number at the end of the quiz. For example:
You got 7 problems out of 9 problems correct!
If there are no problems in the list, quiz should print an error message.
You should not add any new private data items to the class. If you would like to write some private helper functions, you may do so.
A menu driven application file is included in the project folder. You need to include a declaration of a flash class variable and calls to the member functions. When done, place your flash.h and [url removed, login to view] files in the Homework 8 area on Blackboard