I'm trying to get this to execute my main function but for the life of me, I can't seem to let is do that. there are no errors when running the code. What it is suppose to do is to prompt a user for gender between m for male and f for female. If a user enters a wrong character he/she will be prompted again until they choose the right character between the two. What is happening with my code is that it only keeps asking for the gender and never gets to the main function.
// Assignment 2 Question 5a
#include <iostream>
using namespace std;
// The required function inputAndValidate should be inserted here.
void inputAndValidate (char& sex, int& yearMark, int& examMark){
do { cout << "Please enter gender: " << endl;
cin >> sex;}
while (sex != 'm' || sex != 'f');
}
int main( )
{
int yearMark, examMark;
char sex;
inputAndValidate(sex, yearMark, examMark);
cout << "This student is ";
if (sex == 'm')
cout << "male and has a year mark of";
else
cout << "female and has a year mark of ";
cout << yearMark << " and an exam mark of "
<< examMark << endl;
return 0;
}