#include <iostream>
#include <string>
using namespace std;
int main ()
{
string mystring = "This is a string";
cout << mystring;
return 0;
}
this is my code. why it is not working? i'm using visual studio 2010
thank you.
oops.
i created two files in same project.
i thought they are working as two separate files. i just remove first file i created with the codes
#include <iostream>
using namespace std;
int main ()
{
cout << "Hello World! "; // prints Hello
cout << "I'm a C++ program"; // prints I'm a
cin.get();
return 0;
}
so after that the second one executed without errors.
Do you have multiple cpp files in the project with main()s in them? The error seems to indicate you have another file called using_variables.cpp with a main() in it.