This seems simple, but I can't get it to work. I'm writing a simple compiler program in VC++ 6. I'm trying to define three strings that will be checked by my parser to make sure they are syntactically correct. The problem is, I'm not sure how to include semicolons and parentheses in a string. The program compiles, but crashes when run.
Here are the three inputs:
I've tried escaping the semicolons and parentheses, but the program still crashes.
using namespace std;
string input1 = "i+i+i;";
string input2 = "i/n;";
string input3 = "(i*i+i*i+i*i);";
Thanks for the help!
string input1 = "i+i+i\;";
string input2 = "i/n\;";
string input3 = "\(i*i+i*i+i*i\)\;";