Which matches my comment exactly. If the code carries a guarantee that it will never be read by a human, you can do whatever you like with it. I am yet to encounter any code for which such a...
Yes, there is a way to tell incorrect code; you can write the code and then use a program called a compiler on it. The compiler will tell you if the code is incorrect, and will usually give you...
There are many different containers to choose from; each is implemented differently, with different relative strengths. Ultimately, it's up to you to choose the best one for your purposes based on...
The first method is not standard and will not work with all compilers; furthermore, when a pre-processor encounters a #pragma directive it does not understand, it is (usually) silently ignored, so...
Are you getting any compiler errors? The open function of an ifstream object takes a char* and you are feeding it a std::string. If I try that, the compiler objects.
As an aside to your primary question, that call to main() at the end of your function void list(vector<string>files) - what is that for? Why are you calling main from within a function?
I would disagree. I suggest that his job is to teach effectively, not promote book sales. If the best way for him to teach effectively is by having the students read a book, then great. It may well...
The error you listed above indicates that you have a std::String, and you're trying to feed it to something that expects a const char*. This makes sense, as...
What do you mean by "best"? The code you have posted will work on any system that recognises the DIR command in the shell (once you solve that string to char* problem). Which, I think, is windows.
...
Whilst this is true, it is not perfect; I know of occasions on at least one IDE when the IDE and the compiler actually had different opinions, so everything looked great in the IDE, but the...
If you use the switch -E with g++, you will get out the code immediately after pre-processing, so you can see exactly what code is going to the compiler, and you'll know for sure if the header is...
For a long time, the MS compiler that shipped with VS would happily let you do things you shouldn't with off-the-end iterators. As I recall, under the hood, iterators were being implemented to some...