Code:intmain() { cout<<"please enter your first_name and age\n"; string first_name; int age; cin>> first_name; cin>> age; cout<< "Hello," << first_name << "(age " << age << ")\n"; return 0; }
Code:intmain() { cout<<"please enter your first_name and age\n"; string first_name; int age; cin>> first_name; cin>> age; cout<< "Hello," << first_name << "(age " << age << ")\n"; return 0; }
Uh, isn't this roughly the same issue as trying to write a code where I can enter a name and then it says hi, your_name??
Aside from that, when you post "not working code", you must say how does it not work.
Look up a C++ Reference and learn How To Ask Questions The Smart WayOriginally Posted by Bjarne Stroustrup (2000-10-14)
Perhaps the book author expected you to write in the header inclusions and write a using directive at file scope.Originally Posted by solidusMGS
Yes. Well, you don't absolutely need to include headers, but then it means that either you're not using anything externally defined (unlikely), or you're declaring them manually yourself (poor practice because it risks getting it wrong).Originally Posted by solidusMGS
Look up a C++ Reference and learn How To Ask Questions The Smart WayOriginally Posted by Bjarne Stroustrup (2000-10-14)