The or does not work in this while loop:
#include <iostream>
using namespace std;
main ()
{
char s;
do{
cout<<"\n\t\t> Ingrese el sexo: ";
cin>>s;
}while (s!='f' || s!='m');
return 0;
}
The or does not work in this while loop:
#include <iostream>
using namespace std;
main ()
{
char s;
do{
cout<<"\n\t\t> Ingrese el sexo: ";
cin>>s;
}while (s!='f' || s!='m');
return 0;
}
It does not work for you because instead of || (OR) you should use & & amp; (AND). Using OR the condition of the while will always be true because when 'f' will not be 'm'; -)
#include <iostream>
using namespace std;
main ()
{
char s;
do{
cout << "\n\t\t> Ingrese el sexo: ";
cin >> s;
}while (s!='f' && s!='m');
return 0;
}