### calculator problem........

Ok I will mention as much as faster I can my problem since I don't have enough length character as my program is to big.. So I will post one part of the program (one function and it will be the same for the others ) The program works fine but I want when the user add characters (etx:acbd/?<) at addition number I want to print an error message and ask from the user to enter the correct input.. For example::

 ```******** Addition ******** Enter two numbers to addition: ```
f + f

(the program output::)

 ``` Error input. Please used only number. Enter two number to addition: ```

2 + 3

(the program NOW output::)

 ``` The total sum of 2 + 3 = 5 The total of sum is now 5 The total sum of f + f = 0 The total of sum is now 5 ```

Why the compiler skip the else statement of error???
I am really confused please if you have any ideas please let me know as soon as possible... My code is below:::

 ``1234567891011121314151617181920212223242526272829303132333435363738394041424344454647`` ``````void addition() //function for the addition operation... { string num1,num2; double x,y; //variables of the void cout << "**********"<> num1>>num2; x = atof(num1.c_str()); y = atof(num2.c_str()); //change string to double if (num1=="0") //check the string if is number { sum+= atof(num1.c_str()); //add the converted string into sum } else if (num2=="0") //check the second input { sum+=atof(num2.c_str()); //add the converted string into sum } else if ((x == 0) || (y == 0)) //check if the input is string and prints an error message { cout <<"Error input.Please add only numbers"<
*SOLVED*
Topic archived. No new replies allowed.