Hey i have a program based on school i want to do some coding like that even if user inserts +1, it shud work as 11 and +2 shud work as 12 can anybody help me
I honestly have no idea what you just asked, but from what I do understand you don't want an if statement. Do you want a concatenation? (i.e. User adds, 1 + 2 + 3 and they get "123") or do you want addition? (i.e. User adds 1 + 2 + 2 and they get "5"). I'll outline both below: For concatenation you're going to need to make a string, and then do something like: your_string = your_string + user_input_number; Code (markup): Where your_string is the string holding your number string ("123") and user_input_number is the number that was just passed in by the user. Alternatively, if you want to add you can just do: your_string += user_input_number Code (markup): Again, if you could be more detailed in what you need I can provide better assistance
ohh, I can do that..I'm a c++ programmer..send to me your variables for the input and the output part..
Well then you need what dprundle said: if(input == '+1') input = '11'; else if(input == '+2') input = '12'; Code (markup):