I'm assuming I'd compare the intergers in the string. However I can't seem to store the "1" from the string into an interger variable in the program. Is it possible to handle something like this when in a file being parsed?:
#include <iostream>
#include <string>
#include <sstream> // Need this for stringstream
usingnamespace std;
int main()
{
string myNumber("5");
int convertedNumber;
// This won't work
//if (myNumber == 5)
// cout << "Hello!";
istringstream convert(myNumber);
// ConvertedNumber now hold the 5 from the string.
convert >> convertedNumber;
if (convertedNumber == 5)
cout << "It worked!!!";
return 0;
}