Do You Think I Answered This Test Question Correctly?

First off, don't believe a word I say, because I'm one of the worst students the world has seen. I failed more classes than I took, and there were times in which I was a bad influence on others (and on their grades) so not only I gained nothing from school in those times but I also did damage.

Now, with that behind me:

I think you'll get full credit. The question is fairly open ended, vague, in that you are left to decide on your own where you take this. How deep, where to put the emphasis, and when to stop and move on so you have time for other questions.

This reminds me of virtually all questions on all exams I ever took, and in particular those I knew anything at all about, and the impression of frustration and anger they left on me.

Oh sorry, this isn't about me. Sorry, so,

Yes, full points, and if the instructor takes any from you then you can defend yourself. Go to him (her) and defend your answer, stand by it, but moreover be on the offence and in particular go for the question asked, enumerate, say, 2 or 3 correct ways to tackle the question, aggressively dismiss any of "that's not what I meant" the instructor my interfere your sentence with, reply along the lines of "well guess what, how the eff do you know what I meant?! you don't, and neither do I. you responded to my answer with you understood, and so did I. I'm trying to believe you're smart, listen to you, learn from you, not assume you must be wrong -- give me back the same respect and look for where I was going with my answer and you shall find"

Sorry, off the track again

If you want to show YOURSELF clarity about the process of things then you might start from the beginning: The #include keyword is of no interest whatsoever for the C++ compiler. It doesn't see any of it. The #include instruction is a macro intended for the C preprocessor, itself consuming nothing but macros. A C preprocessor macro is a very dumb thing: it is a mere textual manipulator. A macro can replace one piece of text with another, or it can remove pieces of text, or it can insert pieces of text -- and insertion is what #include does.

The #include macro accepts a filename, the file to include. That can be between a pair of <angle brackets>, or "double quotes". The two forms affect how the preprocessor will go looking for that file -- since usually you don't specify an absolute path for it, but merely the base filename. Conventionally the angle brackets refer to system files, whereas double quotes refer to local files. C preprocessor implementations allow you to specify search paths, and therefore override this convention with your own -- but usually to avoid confusion with settle with this convention.

So back to what we have, #include <iostream>, translates into a textual replacement of this macro with the entire contents (and so on recursively) of the iostream header file. If a user happens to change the CPP behaviour then this may well include any arbitrary file with that name. But usually, barring any such nonsensical play and tricks, we can assume this refers to the standard C++ iostream header, which includes class definitions and function signatures for all things console IO -- and probably more, because these things might need things of their own, and so #include these, therefore bringing other names in for the C++ compiler to see. But that is implementation dependent. What is sure is that terminal IO stuff will be brought into the compiler's attention: std::cout, various std::operator << overloads, and on and on -- and this is a huge header, one of the if not the largest of all the standard C++ library.

And then you'd notice you ran out of time, missed the rest of the questions, and failed the exam.

You did fine.

/r/cpp_questions Thread