I have a simple script but I am missing how vars are used. I get the compile error "error: ‘the_string’ was not declared in this scope" on the line that has " cout << the_string;"
Whats the correct way to access "the_string".
Code:#include <string> #include <iostream> using namespace std; int main(int argc, char* argv[]) { bool test1 = false; if(test1) { string the_string("its true"); }else{ string the_string("its false"); } cout << the_string; return 0; }




Reply With Quote