As you can see, I am trying to insert variables into strings. In my new finance program, I am attempting to insert the variables (stock symbols) into strings, which is the URL to the interactive charts in Yahoo! Finance. Here is a code sample from my failed program:
int num = int:: Parse(textBox1->Text);
// ...
private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) {
this->webBrowser1->Navigate("http://finance.yahoo.com/blahblah/xxxxx"num"xxxxx"num".html);
}
In the code above, I tried to put the variable num inside the URL. I formed a string from bits and pieces. The only problem I have now is how to stick the variables in. Here are the errors I ran into:
Warning – C++ CodeDOM parser error: Line: 123, Column: 14 — Unexpected token for a ‘term’.
Error – error C2146: syntax error : missing')'before identifier'num'.
Error – error C2059: syntax error :')'.
I would appreciate any help if possible. Please post any improvements, substitutes, or tips to help. You can also email me at francislau97@gmail.com. Thanks!
Something like this should work
(no compiler available to check actual code)
Here is my stab (still not compiled/tested) at integrating this into your snippet: