String Convert to Char ?
I'm using Visual C++
in my text box i assign a CString variable
and i want to convert it to integer. How can i do it ?
CString = "5+5*5"
int = 5+5*5
actually i have assign a int variable to the textbox
but when i insert 5+5, the int variable only contain 5 not 5+5.
Please help me, and thanks you very much.
i'm planning to make a calculator for my course's project.
Well i already tries atoi() but it just didn't work.
i think it can't convert the arithmatic operator (-,+,*,/)
plssss help me...
Okay. The solution to this calculator problem is simple; however, there is a considerable amount of coding involved. Here is one algorithm.
- extract text from editbox into a string object or CString object
- enter a for-loop
- if isdigit(myString[i])...
Note: There are numerous ways to determine the exact integer before the "+, -," etc. signs. Anyways, you will need to implement one algorithm to extract the exact integer before the a sign in during this step.
- this next character must be a sign. Enter a switch and determine what mathematical sign the user has entered.
- push the character into a queue
- final step: run a for loop and carry out the addition, subtraction, etc.