is this possible?

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 /.

thx for your time,

The dude
Last edited on
are you trying to know what "friend." mean in the private message?

or you don't understand my question?
Something like this:

1
2
3
4
5
6
7
8
9
10
11
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.

is that clear enough?

and thx JLborges
yeah but if you do something like /5 i don;t want to make a whole list of possible answers.

(or is "i don;t want to make a whole list of possible answers." a very simple thing?)




what?
sorry that doesn't help me... I WANT ANSWERS
ANSWERS
oh check out my post in LOUNGE board :)
Topic archived. No new replies allowed.