Hi I don't know if this is possible but if you enter something like
/23,
Will you be able to ONLY detect / so a new line of code would run? Its especially useful in a calculator.
In case you don't understand, I want the user to input something with /randomsomething, I know you could do like (if input==/randomsomething){
some code;
}
but i don't want an EXACT answer, I only want to detect the /, and I don't want the user to JUST type /.
char oper ;
double number ;
std::cout << "enter the operation and a number eg. /234.56 : " ;
if( std::cin >> oper >> number ) // if input was successful
{
std::cout << "operation: " << oper << " number: " << number << '\n' ;
// check if operation == '/' etc.
}
bro the friend. in the private message, I just wanted you to know we are friend in case you forgot me.
and the question: (this is why i put "is this possible" for the title),
if you have to ask the user to enter a number to divide, if you want them to enter /23 to divide, i want to ONLY detect the /, not the exact thing they inputed. so...
Please enter a number;
cin>>number;
please enter the number you want to divide. (here is the part [i want them to input /23 to divide 23. I don't want to make a list of all possible number they might input, so i ONLY want to detect the / to know that i am dividing.] ).
KEY PART: here is the part [i want them to input /23 to divide 23. I don't want to make a list of all possible number they might input, so i ONLY want to detect the / to know that i am dividing.