Hi,
I am a new tutor for a college CIS department & just came back to C++ after 10+ years. I am trying to tutor students using the Dev-C++ compiler for very basic programs using the book C++ without fear.
When I start a new console project, the #includes are already there.
The book suggests deleting all the code & starting new, but any time I try to hand type #include it never recognizes it written this way but it does recognize it if I put a space in the middle (# include).
Several students have had the same experience & I can't explain it, as every code text does not have this space. The online tutorial for Dev-C++ does not mention anything about this.
Is this just a quirk of Dev=C++ or are we doing something wrong?
More importantly does it matter & would we have to delete the space to use the code in every other compiler?
First, what version of Dev-C++ are you using? If it is 4.9.9.2 beta, the normal one, then I would seriously consider avoiding it if at all possible - its about 10 years old now (and hence ships with a 10 year old compiler). If you insist on Dev-C++, I would suggest going to Orwell Dev-C++, which is newer and has a newer version of MinGW, but preferably I would suggest something like Code::Blocks.
As for how the #includes work, as far as I know having spaces between the '#' and the directive doesn't make a difference, and the same goes for having whitespace between the start of the line and the hash symbol.
It says 5.6.2. I downloaded it from the Orwell Version page. I used the link in book, but saw that it said it was discontinued & followed the link to the new Orwell project.
I am working with a student with learning challenges. We just spent 2 weeks going in circles arguing over Dev-C++ vs Visual Studio Express, and the student freaked out when they saw the VS IDE any way, so the point was mute as she insisted on staying with DevC++.
I finally got her back on track & through 2 chapters of the book on DevC++ so I am wary to try to change her again.
What would code blocks do for her?
The book already discussed optimization & showed them how to use one variable instead of 2 so now she wants to use one variable for everything: the input and the loop counters. I tried to explain that for these simple programs it "work" but that later on, she will want to to use each variable independently for other things too. She accepted the answer but clearly with doubts. (She must be from Missouri).
It seems that it does not matter (about the # include), except when we type it "correctly" it does not work & I did not understand why. My pc is overloaded as it is, so I did not want to add on another compliler just to try it out. I tried one of those online/in browser code sites & the code did not work at all, hence my original question.
Could we see your code? You might be doing something wrong, especially if it isn't working on the compilers online (which have been tried and tested many times). Also, with the one variable vs two, have you tried explaining that that kind of efficiency makes no difference in modern computers at all? Unless you are in an extremely memory constrained, embedded environment, 8 bytes instead of 4 (or 4 instead of 2) isn't much when you can easily have millions of bytes of memory to play with. Its much better to have readable code that makes sense, unless you know that a certain bit of your code is a bottleneck.
ne555: Thanks so much. Yes we caught the stdlib typo & its nice to be prepared for the others.
NT3: I am aware of the fact that these "efficiencies" are no longer critical. Its the book that mentioned it, not me. I am just dealing with the fallout.
The original message states the student has learning challenges. Just telling them something does not necessarily mean they get it instantly. If they did, I would not have a job. The student is motivated & working hard, but too much information at once creates an overload. Theory does not help- seeing concrete code examples that work does.
There is no "code" to post unless you want to see every cpp file we have.
All of the files have the same issue:
They work fine when we type # include & they don't work if we type: #include.
Based on you first answer, it should NOT make any difference, but it does.
The compiler created "empty" page that is created (when you open a new console app) DOES have the code written "properly" as #include & works, which is why I am totally confused as to why any handwritten ones don't.
Well, I checked the bug report trackers for both Orwell Dev-C++ and the TDM-GCC build bundled with it, and no problems matching your specifications have appeared. Maybe you should consider submitting it as a bug report? Also, have you tried typing out two 'identical' programs and using a command line utility (based on your OS) to determine differences between them? Have you tested what happens if you save and close the files, then open them again and retry?
Also, I missed the bit where you said she had learning issues, sorry for the misunderstanding. And, obviously I wouldn't want to see every source file you have, just an example of a source file code that worked and one that didn't, to see if it was your keyboard typing strange unicode characters that happened to look like '#' signs or something (I've seen it happen before) (though that doesn't account for the adding a space afterwards fixing it). Also, the main reason I was asking was because of what you said here:
noobtutor wrote:
I tried one of those online/in browser code sites & the code did not work at all, hence my original question.
Sorry if it came out as rude or condescending - that was not my intention at all, and often its hard to put specific inflections into your writing through text.
NT3-Sorry for the delay in responding. I honestly though I had, but I don't see it here, so I guess I was talking to my pc. Your apology is accepted, albeit not necessary. I am very impressed with the fast & USEFUL responses I received here.
We are on break for the next 2 weeks, but I am sure I'll be back after that as I have to stay one step ahead of my student & according to the reviews on our textbook- that is going to take some work on my part.
FYI-I emailed the author at the email listed in the link & have not received a response.