Thread: Do you know some online tutorials with good examples on different C++ aspects?

  1. #1
    بابلی ریکا Masterx's Avatar
    Join Date
    Nov 2007
    Location
    Somewhere nearby,Who Cares?
    Posts
    497

    Do you know some online tutorials with good examples on different C++ aspects?

    I will be teaching some novice students C++ programming , and this is my first time trying to teach C++!
    I need some good examples that i can give the students so that they can comprehend and also don't get confused!
    I have already considered using a text book as a reference but since the time is limited and mostly those textbooks start with a scenario of some kind and go on with that
    due to time constraint i think i will not be able to cover everything like those books or get it right like them.
    Do you happen to know any source which contains good examples on different subjects of C++ that i can use to teach novices C++ without confusing them with nonsense or bad examples ?

    Any help is appreciated
    Thanks in advance
    Highlight Your Codes
    The Boost C++ Libraries (online Reference)

    "...a computer is a stupid machine with the ability to do incredibly smart things, while computer programmers are smart people with the ability to do incredibly stupid things. They are,in short, a perfect match.."
    Bill Bryson


  2. #2
    Lurking whiteflags's Avatar
    Join Date
    Apr 2006
    Location
    United States
    Posts
    9,612
    Why are you staying away from textbooks? How old are they? It's not uncommon here for a student to have to read around 60 pages per week per class. I had one teacher tell me it should be 100. The point is, don't be afraid to assign reading, especially if you want to get anywhere.

  3. #3
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    I suggest using Accelerated C++. If you can teach using the material up to at least chapter 4, that would be pretty good ground covered to start writing useful programs.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  4. #4
    Registered User
    Join Date
    Jun 2013
    Posts
    66
    Alf Steinbach wrote a "Correct C++ Tutorial" some years ago, and it is the only one I would recommend. Unfortunately, I cannot find it now, so your best bet would be to use a good textbook even if you are unable to cover all of it.

  5. #5
    Registered User
    Join Date
    Aug 2003
    Posts
    1,218
    due to time constraint i think i will not be able to cover everything like those books or get it right like them.
    IMO do it right or don't do it at all. The greatest disservice you can do to people is teaching them something that is wrong. What is the time constraint? Do you plan to introduce C++11 concepts (IMO you should definately do it if the time allows you to get that far)?

  6. #6
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    Erm, if possible, you should introduce C++11 concepts BEFORE anything that is older. Using old standard is great for compatibility and all, but it's harder to teach people new things than to force them to do research. Get them used to using new features and force them to do research to find out how to do it with older features and they'll stick to using newer features. Do it the other way around and they'll keep using older features.
    Anyway, Accelerated C++ was a good book for its time, but it's time to move on. I recommend C++ Primer, 5th edition: ACCU :: Book Reviews Search
    Remember: a good book will always be better than online tutorials. To pick a book, select what you need to teach and base the course on that. Students can even read the book on their own (what is not covered) and keep it for future reference. And it will teach much more than a few tutorials.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  7. #7
    بابلی ریکا Masterx's Avatar
    Join Date
    Nov 2007
    Location
    Somewhere nearby,Who Cares?
    Posts
    497
    Thats a 40 or 50 hours class and thats what makes it difficult for me since i really like to tell them every thing i know , tell them about the new standard , the easy way of doing things and i really dont like to disservice them since i didnt learn anything from my C++ teachers! they themselves didnt know anything about C++ standards!
    @Shakti: I am not going to teach them something Wrong!! i just cant emphasize much or dig deeper and explain more ! thats why i am trying to get good examples so that i can present in this time frame and the students grasp what i have in mind .
    @Whiteflags: The good textbooks on C++ , specially those covering the latest standards are not common in this country or at least in my hometown, the best textbook they would find is deitels How to Program C++ ( probably the 5th or 7th edition ) which is not that up to date and doesnt cover C++11 . this book is huge and these guys are school students who are eager to learn programming ( i dont know why they chose to learn cpp!! but anyway!) and i exteremely doubt that they would spend lots of money on a book they are not going to cover ! i think that book will scare them all !!
    I will definteley recommend some textbooks but i need some thing thats suitable for this kind of classes .
    @LaiserLight and @sonjared : I will have a look at that books you suggested and see if either of them fits the job
    @Elysia : Good point , actually i was going to cover the fundamentals in the old fasion way , so that the can have a taste of the old way of doing things and then quickly get to C++11 and accustom them to the new standards
    so they truly get the idea and use it for themselves . I'll try my best to achieve what you suggested , i just need to get a good textbook and have a look at them so that i dont confuse those kids
    Thank you guys again
    Last edited by Masterx; 06-30-2013 at 01:22 PM.
    Highlight Your Codes
    The Boost C++ Libraries (online Reference)

    "...a computer is a stupid machine with the ability to do incredibly smart things, while computer programmers are smart people with the ability to do incredibly stupid things. They are,in short, a perfect match.."
    Bill Bryson


  8. #8
    Lurking whiteflags's Avatar
    Join Date
    Apr 2006
    Location
    United States
    Posts
    9,612
    @Whiteflags: The good textbooks on C++ , specially those covering the latest standards are not common in this country or at least in my hometown, the best textbook they would find is deitels How to Program C++ ( probably the 5th or 7th edition ) which is not that up to date and doesnt cover C++11 . this book is huge and these guys are school students who are eager to learn programming ( i dont know why they chose to learn cpp!! but anyway!) and i exteremely doubt that they would spend lots of money on a book they are not going to cover ! i think that book will scare them all !!
    I only said that you should assign reading. I did not recommend any particular textbook. You seem to be looking for a textbook that is short, which is fine. I only wanted to tell you that college-age students read a lot, quickly. The rate I gave you (60 pages per week per class) is a pretty steady and fair rate. I've taken several 6- and 8-week courses that progress at this pace.

    Your students' financial issues aren't necessarily your issues. I can respect that you don't want them to spend too much money but really, if you design the course unfairly or use really ........ty material it is going to be worse than the $50-$100 price tag of a new book. And besides, at least here, you can rent or buy used books at steep discounts.

    I would not worry about C++11 too much. It really depends on how you decide to teach the class. If your book is oriented around that, your tools have good support, and you can teach the course, do it. But I strongly disagree with Elysia's point of view. Studying C++11 should not be hard in the future, especially if you have a background. You want to give them that background: a correct background, from a teacher who understands his assigned reading material and the tools he used in class.

  9. #9
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    Quote Originally Posted by whiteflags View Post
    ...But I strongly disagree with Elysia's point of view. Studying C++11 should not be hard in the future, especially if you have a background. You want to give them that background: a correct background, from a teacher who understands his assigned reading material and the tools he used in class.
    That is precisely the problem.
    People who understand older standards do not necessarily have the mindset to actually learn new things. Hence, they will continue to be old school programmers, knowing only what they see and think is right. If the code base is old, it is likely that it will always continue to old with more stuff added with old standards. Thus, they will likely only know the older standard.
    But if you teach them the latest greatest (and for the PC platform, the tools are here), they will be more productive, write better and faster code from the get-go (the advantage of the newer standards), and you will force them to learn the old ways later to maintain old code. Thus, they will likely know both standards, if they need to.
    A "correct" background, as many here agree on, is top down approach. Teach C++ first, not C. Likewise, this should apply to newer standards: teach newer standards first, then older if necessary. If they learn the older standard first, they have to get rid of old habits when learning the new standard.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  10. #10
    Lurking whiteflags's Avatar
    Join Date
    Apr 2006
    Location
    United States
    Posts
    9,612
    I apparently need to explain my points.
    I would not worry about C++11 too much. It really depends on how you decide to teach the class. If your book is oriented around that, your tools have good support, and you can teach the course, do it.
    I actually encourage teaching recent things, but I don't want Masterx to teach a C++11 unit without C++11 materials.

    Studying C++11 should not be hard in the future, especially if you have a background. You want to give them that background: a correct background, from a teacher who understands his assigned reading material and the tools he used in class.
    Here I am working on the assumption that they are not going to stagnate if the course is in fact designed around C++03 or something. Only students who do work will succeed and learning is life-long and many times self-directed.
    Last edited by whiteflags; 06-30-2013 at 03:21 PM.

  11. #11
    Registered User
    Join Date
    Jun 2013
    Posts
    66
    People who understand older standards do not necessarily have the mindset to actually learn new things. Hence, they will continue to be old school programmers, knowing only what they see and think is right. If the code base is old, it is likely that it will always continue to old with more stuff added with old standards. Thus, they will likely only know the older standard.
    But if you teach them the latest greatest (and for the PC platform, the tools are here), they will be more productive, write better and faster code from the get-go (the advantage of the newer standards), and you will force them to learn the old ways later to maintain old code. Thus, they will likely know both standards, if they need to.
    Your logic is flawed. What happens when you teach C++11 and a new standard comes out? Students who learned C++03 yet refuse to learn new things would stagnate eventually even if they were taught C++11 instead.

    A better approach would use the simplest subset of C++ practical for learning the basics while also emphasizing that the field changes constantly and programmers must work to keep up to date.

    What many people seem to miss is that the bleeding edge is very rarely best when it comes to teaching novices.

  12. #12
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    Quote Originally Posted by sonjared View Post
    Your logic is flawed. What happens when you teach C++11 and a new standard comes out? Students who learned C++03 yet refuse to learn new things would stagnate eventually even if they were taught C++11 instead.
    Have you seen the state of C++ code in the world? Most of it is plain C with some bolted on C++ stuff. It's not even C++03!
    There are many people out there who attain skills only because they must. Like students are usually taught math even though they are attending computer science. Are they going to keep up-to-date with mathematical advancements? I think not.
    Therefore, it is important to teach them the most modern* way of doing things.

    A better approach would use the simplest subset of C++ practical for learning the basics while also emphasizing that the field changes constantly and programmers must work to keep up to date.
    Those that have a passion for the language will probably keep themselves up-to-date. But there are many who simply will not. They learn just enough for what they need.
    Are you keeping yourself up-to-date with every language you're using? You probably aren't, nor am I.

    What many people seem to miss is that the bleeding edge is very rarely best when it comes to teaching novices.
    True, but I don't think C++11 is bleeding edge. Sure, it's relatively new, but it's not like came out just yesterday such as some features from C++14 that is creeping into compilers right now.

    *) In this context, modern means techniques that are sufficiently proven in practice and are up-to-date,
    Last edited by Elysia; 06-30-2013 at 04:24 PM. Reason: Typo
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  13. #13
    Registered User
    Join Date
    Jun 2013
    Posts
    66
    Therefore, it is important to teach them the most modern* way of doing things.
    This is a moving target to the point where a curriculum would be outdated before it was even rolled out. Should teachers attempt to remain relatively up-to-date? Absolutely. But there is a certain point where being as modern as possible has no added benefit to students. What major C++11 features would you suggest are absolutely critical for a complete novice? I can't think of any that could not wait until a later class.

    But there are many who simply will not. They learn just enough for what they need.
    Once again, this is where the logic fails. If learning C++03 means the student would stop learning at C++03, teaching C++11 wouldn't fix anything; it would only delay the problem. The student would still stop learning at C++11. Thus the problem is not which standard is taught, the problem is failure to keep up in a constantly moving field. Thus a focus should be on making sure students know that C++ is still evolving and what they learn in the class is not the end all be all.

  14. #14
    Master Apprentice phantomotap's Avatar
    Join Date
    Jan 2008
    Posts
    5,108
    I will be teaching some novice students C++ programming , and this is my first time trying to teach C++!
    O_o

    Well, first off, good luck, good patience; you'll need both in plenty.

    I vote again--as many as allowed--for "Accelerated C++". The book is superb. I would not recommend "C++ Primer", but the fifth edition is certainly fine. (Do not get earlier editions.) Of course, if you are worried about your student's financials, "Accelerated C++" can likely be had for cheaper thanks to its age. I've tutored and mentored a fair few kids building over/beside "Accelerated C++" and have never failed for lacking quality material.

    As for starting with C++11, many core language features (The C++11 features related to simplifying the implementation of expressions and generics such as "static asserts", "alternate function declaration syntax", "perfect forwarding", and "type inference" are core language features.) should be avoided at first because implementing robust generics should be avoided at first. (If you suggest your students dive too deeply they will drown. Feel free to see our own members who've tried and failed to learn C++ because they found too much C++ too fast.) Some of the core language features, such as `nullptr', "lambda functions", "move mechanics", and "uniform initialization", are more generally useful and may be gently introduced as part of normal techniques. (That is, for example, when teaching about pointers you'd introduce the preference for `nullptr' over `NULL', or you would, when teaching constructors, show how "move overloads" are preferentially implemented using the same provisions used for the canonical "copy/swap idiom".) For the C++11 features which are library additions, you should prefer C++11 alternatives even if it would mean introducing "TR1" forward libraries or "Boost"; these library facilities would include `std::arrary<???>', `std::unique_ptr', `std::shared_ptr<???>', `std::function<???>', and `std::bind'.

    As for the everything else, please consider C++ as a unique language separate and distinct from C. (This will be natural if you reach for a quality book.) This will mean showing preference to some mechanisms over others despite all being useful.

    Examples (read "$(mechanic) > $(alternative)" as "prefer $(mechanic) over $(alternative)"):
    Code:
    `std::string' > `char[]'
    containers > native arrays
    references(&) > pointers(*)
    algorithms > explicit branching
    `std::shared_ptr' > new/delete
    Soma
    “Salem Was Wrong!” -- Pedant Necromancer
    “Four isn't random!” -- Gibbering Mouther

  15. #15
    Lurking whiteflags's Avatar
    Join Date
    Apr 2006
    Location
    United States
    Posts
    9,612
    Have you seen the state of C++ code in the world? Most of it is plain C with some bolted on C++ stuff. It's not even C++03!
    Are you employed? What projects have you worked on? I expect specific examples if this question has merit.

    Like students are usually taught math even though they are attending computer science. Are they going to keep up-to-date with mathematical advancements? I think not.
    So?

    Recent research is actually somewhat exciting, but I'm not aware of the immediate impact on computer science. You're comparing apples and oranges.

    I think you're saying that other people aren't willing to keep up-to-date like you are, but that's arrogant, and I want to think better of you than that.

    True, but I don't think C++11 is bleeding edge. Sure, it's relatively new, but it's but came out just yesterday such as some features from C++14 that is creeping into compilers right now.
    I would really like a discussion on standardization sometime. I think the board could learn a lot from the more experienced people here, who have followed the process, and can offer specific insight. Statements like the quoted one make me the most angry.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Good bitshifting tutorial or examples?
    By Striph in forum C++ Programming
    Replies: 2
    Last Post: 10-07-2012, 02:58 AM
  2. what are some good C++ source code examples?
    By orion- in forum C++ Programming
    Replies: 4
    Last Post: 09-13-2005, 09:24 PM
  3. Looking for examples/tutorials
    By Eibro in forum Windows Programming
    Replies: 2
    Last Post: 04-16-2003, 09:56 PM
  4. FAQ: Examples of good questions (General)
    By Prelude in forum FAQ Board
    Replies: 1
    Last Post: 10-11-2002, 08:57 PM
  5. I need some good win32 tutorials online......please...anybody
    By incognito in forum Windows Programming
    Replies: 4
    Last Post: 01-13-2002, 05:03 AM