How do I only accept specific string input
I want to write a code that finds the derivative to any function and want to take a user input on what type of function they're inputting is. Essentially I tried to write a while loop that only accept valid answers but the while loop isn't behaving as intended. Here is my code:
int main()
{
std::cout << "Welcome to the differentiation calculator: ";
std::cout << std::endl;
std::cout << "Please input what type of function you have: Algebraic,Trigonometric,Exponential, Hyperbolic : " << std::endl;
std::string UsersTypeOfFunction;
std::cin >> UsersTypeOfFunction;
while (UsersTypeOfFunction != "Hyperbolic" || UsersTypeOfFunction != "hyperbolic" || UsersTypeOfFunction != "Exponential" || UsersTypeOfFunction != "exponential" || UsersTypeOfFunction != "Trigonometric" || UsersTypeOfFunction != "trigonometric" || UsersTypeOfFunction != "Algebraic " || UsersTypeOfFunction != "algebraic")
{
std::cout << "Please input a Valid function type. ";
std::cin >> UsersTypeOfFunction;
}
return 0;
if my code is the issue please let me know