Hello Willogical,
Just reading through your code this is what I see:
Without what would be above "main" it is hard to say if you did anything wrong.
In "main" everything works down to line 19. Lines 19 - 22 all call functions that return a value, but you never collect this return value or use it.
The if statement on line 23 works fine for "Q", but for everything else the if statement will be bypassed and rhe "return" statement will end the program. The "return" statement needs to be after line 28.
In the header file:
Header should not have "include" statements. These are best left for ".cpp" files.
And
using namespace std;
should never be in a header file. Read this for more information.
http://www.lonecpluspluscoder.com/2012/09/22/i-dont-want-to-see-another-using-namespace-xxx-in-a-header-file-ever-again/
In the function "Takeinput()". The use of "std::getline(...)" is OK,but the next line, even if it would work, looks like it does, it is not needed, the "std::getline(...)" will read everything up to and including the new line, e.g., (\n). Which makes the "ignore" kind of pointless. The more used way of writing the "ignore" statement is
|
std::cin.ignore(std::numeric_limits<std::streamsize>::max(), '\n'); // <--- Requires header file <limits>.
|
The first parameter just creates a very large number that is dependent on the computer and compiler along withe the header files used with that compiler. You can use any number you want for the first parameter. I recently had a program where I had to use "1" to make it work.
The third line returns two spaces. I am not sure why you would want to return two spaces, but you do not collect this in "main" or even use it there.
The same problem with the other two functions. You return two spaces, but never use them.
The enum "choice" can be written simply as:
enum choice {A, B, C, D, E
. When no value is given for the first name it starts at zero and increases by one for each successive name.
The "SetOutput" function is mostly OK except that you return two spaces that are never used.
In the if statements you have already been told how that should be written.
As I look at the line, #66, I am slowly coming to the conclusion that it will work, but I believe you do not realize what the value of "Cases" will be. Not the "A" that you might be think, but the value zero. The next if statement will always be false because "Cases" will contain a number not a letter. You may want to give this a read
https://en.cppreference.com/w/cpp/language/enum It will explain what I have been saying in regards to the "enum". The call to the function "SetOutput" is not needed because you are not only sending the wrong variable to the function "CaseA" is defined as a "public" variable therefor the entire program has access to this variable, so there is no need for a function to set this variable. just use its name and set it equal to something. Although you may have a problem setting a "string' to an "enum" int. You will have to change the "int" to a "string" first.
In the else part the outside set of parentheses () should be a set of curley braces {} because the {} define a block. A moot point because the "cin.ignore" is not needed as you have not used "cin" to get any input. The same is true for the other "else if" and "if" statements.
Your next set of "public" variables should be under the "private" section. As "public' variables the whole program has access to them and this tends to defeet the purpose of the class protecting the variables.
Without the missing pieces I will have to guess at what is need to get the program working so I can test it.
Hope that helps,
Andy