Hey, I am using Visual C++ 2008 to design a windows form. I have several inputs where I want to user to input some numbers, which I will apply to a formula and then output the result of the calculation. My problem is that I am having trouble converting the values in the input fields to integers so that they can be applied to the formula. I'm relatively new to C++, so I am having a bit of trouble with data type conversion. I want to get this->textBox1->Text and store it in the a variable as an integer. How would I do this?
#include <iostream> #include <sstream> using namespace std; int main() { stringstream resultStream(this->textBox1->Text); int result; resultStream >> result; cout << "Result: " << result << endl; return 0; } Code (markup):