is this possible?

Sep 4, 2016 at 3:19am
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 Sep 4, 2016 at 4:01am
Sep 4, 2016 at 3:35am
are you trying to know what "friend." mean in the private message?

or you don't understand my question?
Sep 4, 2016 at 3:53am
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.
}
Sep 4, 2016 at 3:58am
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?

Sep 4, 2016 at 3:59am
and thx JLborges
Sep 4, 2016 at 4:04am
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?)




Sep 4, 2016 at 4:12am
what?
Sep 4, 2016 at 4:13am
sorry that doesn't help me... I WANT ANSWERS
ANSWERS
Sep 4, 2016 at 4:14am
oh check out my post in LOUNGE board :)
Topic archived. No new replies allowed.