2012-10-08, 11:44 PM
Imagine Wrote:For my assignment, I'm trying to make a program that stores my name as a variable and then displays "Hello! My name is <whatever value is stored in the variable". The problem is that my program won't function properly.
What I have so far:
Code:#include iostream
using namespace std;
int main () {
string my_name = "Jonathan Chiou";
cout << "Hello! My name is " << my_name;
return 0;
}
What I get:
Line 9: error: #include expects "FILENAME" or <FILENAME>
What am I doing wrong, and what does this error mean?
A couple of pointers. Pun not intended.
1. You need to put brackets (< and >) around each library inclusion.
2. std:
tring is part of of the <string> library so you should probably include it.3. return 0 is entirely optional in C++ but required in C.
4. Try to avoid using namespace directives (using namespace std) as in the future you could mess something up without knowing. Try using namespace declarations instead (e.g. using std::cout

