What I'm trying to do is use an if and else statements to process a char data type. If one was to input any of the following: S, O, M; then the program would continue on (leaving it to output "null" until I get this figured out). If any other character is typed in, the program would output "Invalid Employee Code".
What I have at the moment however is a program that outputs "null" no matter what I input. I've never used char data types with an if and else statement so I'm at a loss here.
Always declare and initialise your variables, one per line. That way you know you have initialised everything, and not missed one sometime later in your code. One per line is good, so you can comment things like expected ranges of values, or any other useful info.
Don't be afraid to have longer variable names, if it make them more meaningful and aids understanding - especially of others are going to read your code. For example, I would have had EmployeeCode and EducationCode. This is an advantage when you start to have larger projects.
EDIT:
Don't have usingnamespace std; - google to see why this is so, and what to do instead.
First, it evaluates emcode == 'S' which could be true or false. Then there is the OR operator, but there is no conditional associated with the right hand side, so it evaluates to true. This makes the result of the OR statement to always being true. The same follows for the other OR statements. So line 30 will always be true.
If you are using an operator, function, class or algorithm for the first time: then read the documentation for it, rather than rely on what you are thinking as to how it works.
Be careful using std::cin - it only reads up to the first whitespace. For example if someone has a surname of "Di Masi" , then you won't get the expected results. Use std::getline instead.
Did you read up about namepsaces? Ideally one should put their code in it's own namespace.
In C++, you can leave the declaration of variables until just before you need to use it. So flag1 could be declared just before line 29.