I was making a calculator, this is one of my files:
#include <iostream>
float getInfo()
{
std::cout << "Enter a number: ";
float input{};
std::cin >> input;
return input;
}
char getOperator()
{
std::cout << "Enter an operator: ";
char operand{};
std::cin >> operand;
while (operand != '+' && operand!= '-' && operand!= '*' && operand!= '/')
{
std::cout << "Invalid operator, enter valid operator: ";
std::cin >> operand;
}
return operand;
}
The variable identifier operand used to be operator, however my IDE wouldn't recognize it as a variable. Hence, the question.