Hot answers tagged

8

I think you're having trouble justifying the study of C++ because of the way that you're thinking about it. If you are aiming towards the practical benefits, then you immediately get to the following trap: neither you nor your students has any idea what languages they will work with in the future, so neither you nor your students have any idea what ...


5

There are many reasons for wanting to learn a new language, whether C++ or something else. I'll try to make this general enough to address Timothy Truckle's concerns in a comment, but also the questioner's direct question. If you are a scholar you learn a new language because it gives you some additional perspective on programming that the languages you ...


5

I wouldn't fuss too much over whether a language is "hard" or "easy". There are plenty of reasons to learn a language. Learning for a career is a great reason! Languages are usually organized around certain central ideas. Haskell is a pure functional language, Eiffel is a pure Object Oriented language, and C is designed to reflect very closely what a ...


4

Your question deserves a long discussion, but I will try to narrow it down to few points. First, remember that you are dealing not just with a "compiled language" such as Java or C# (that could be much easier targets for you), you are dealing with C++ that was designed with backward compatibility with C as a killer feature, and C was created in late 70s. It ...


4

Create an object that creates a new file and writes in to it over several method invocations (not just one). Assure that the object has been deleted before continuing (Make the object go out of scope on the stack or delete a reference and let the reference go out of scope.) You need to assure that he file was closed. The destructor is the proper place to ...


4

I want to tack on to Buffy's answer by focusing on one line from your question: "I want him to learn C++,Java,Html" (emphasis added). The bigger question should be "What does he want to learn?" Part of the beautiful challenge that is teaching is getting students to want to learn what we want to teach them. What has your brother shown interest in? What has ...


4

While I would suggest a different language for beginners, I'll take it as given here that the students need to learn C++ and not just programming for general use. In that case, teach them Modern C++. That means C++ versions 14 and 17 and don't bother with anything earlier. To do this find a good book that focuses on those versions (or later if you are ...


3

Do it in two steps: There are resources for each part. Start by learning how to compile, link, run code, and launch the debugger, from the command line. Then learn how to write make files. You should also read Recursive Make Considered Harmful by Peter Miller. It should direct you away from a lot of common bad practice. When I applied what I learnt from it,...


3

For make consider O'Reilly book. It is a perfect intro. Honest to goodness. The GDB one is not so much an educational tool, it is a reference, but I doubt you'd find anything which would teach you how to use GDB any better. The GDB learning curve is short and easy. I also doubt that there is a resource dedicated to gcc any better than the online ...


3

There are 2 good examples of patterns where the destuctor is a key. This way you can teach a couple of useful patterns on the way. RAII - Resource Acquisition Is Initiation Rule of 3/5/0 It's easy to give a RAII assignment, just any C style handle that can be released in the end (Like a File handle, windows handle, etc). If they are more advanced, you ...


2

C++ seems like an awfully steep climb for someone that age with no experience. I'm not sure what educational resources are available directed at that age. I'd suggest that you start out with something more forgiving. Python has been a pretty good choice and has an OO core without quite so many "guns, knives, and clubs" which was an original description of ...


2

I have tried to learn and teach C++, I have seen others try to learn or teach it. I have seen people come out of university, having “Learnt it”. I have seen no success. None of these people have learnt it well, few have learnt it at all. The only exception are those that first learn another OO language. The best OO language to learn first is Eiffel. ...


2

There are a few places C++ (or C, or rust or ...) is more useful than Java[1] because C++ does (what Rust likes to call) "zero cost abstractions". The idea is that C++ gives you the power to be as low level as you want to get, and at the same time as high level as you want to go. Real Time. Note, I didn't say fast. real-time doesn't always mean fast. ...


2

Programming languages are like tools. Different tools are better for different tasks. Hammers are useful for certain tasks, and saws are useful for other tasks. The same is true of programming languages and other programming tools. For example, one construction company might get their wood from a place that only sells full-sized logs, which they then have ...


2

There are many ways to do this, they basically rely on the "culture" of students and the purpose that they should learn. C++ is a multiple model and not "pure" in any of them, so... Teaching language and realism is a process: start with some courses before the process: Make them know about the two, compilers, etc. do not go into detail, but tell the path to ...


2

I would make it hands on and C-based, with very little OOP in the beginning. You can code in C++ using it as a "better" C. You'd introduce classes by the way without making a big deal of OO stuff. I'd focus on I/O, data structures, particularly, containers such as lists and arrays, and algorithms such as search and sorting. Maybe write simple utilities, e....


2

welcome to our community ;) Is learning C++ recommended for beginners? In general, I would suggest that it is not the optimal choice for a beginner, since there are other languages out there that are powerful, widely supported, used in a range of industries and (perhaps most importantly for a beginner) have a simple syntax with powerful features. I am ...


1

For a gaming novice I would suggest Unity instead of Unreal. Unity has a lot more learning resources online. Unity uses C# which is Microsoft's version of Java. Unity and Unreal are comparable, each has its pluses and minuses. An excellent place to start with Unity is at learntocreategames.com. You can actually communicate with the author. Prices are ...


1

This answer is based on the assumption that you are a competent programmer, but want to improve your C++ and learn how to design and write larger scale programs. I find the best way to start is to imitate something existing. This means reading code. Another tool you didn't mention, but which will be part of a project, is for source code control (likely git). ...


1

Yes some people recommend it. These are the “What is use in industry?” people. However this is the wrong question, it may be easier and quicker to learn several languages first. My experience I have tried to hire C++ programmers. It is very hard, there is a lot of variance between claims and reality. Most people claiming many years of C++ can not write ...


1

I would say that you need to learn a completely different (old fashioned, perhaps archaic) programming paradigm, non-interactive coding. In Ye Olden Ancient days, a programmer would often write out a complete program (or at least large parts) on paper, before even going near a computer (or punch card machine). Try it as an exercise. See how much code (how ...


1

You can find REPLs for C++ with an online search, but my advice would be different. I do the following with Java, but equivalent tools for C++ exist. First, I use a sophisticated IDE (Eclipse) that, among other things, does error highlighting as I type. A typed language like C++ permits many errors to be caught early, normally in the compiler, but they can ...


1

It's okay, but I think it's a bad idea. I've taught my kids C++ when they were age of 9 using a beginner book on building a game using C++ after they had a brief education on Scratch and Python. They liked it, but I thought it was a waste of time because the language, toolsets and many of study materials are not kids friendly. Almost everything about C++ ...


1

A separate approach entirely from my other answer is to code the main method of a project yourself, but ask your students to build the classes that will make your main method accomplish its task. This actually opens back up projects like linked lists, as your main will use a slightly different spec than the natural C++ library in any case. Just include ...


1

I'm not a native of C++, but it seems to me that a Conway's Game of Life simulator, with cells as immutable objects, would be a great way to show the need for a destructor. Without one, your program would quickly run out of memory. And, of course, it's not a bad approach to the problem. All you'd have to do to demonstrate why such an approach is ...


1

I'm a multi-platform programmer who has spent many years using C++. In the last 5 years that has included: The Realm mobile database engine used by a couple of billion people worldwide, embedded in their mobile apps. I mainly worked on their Xamarin SDK in C# but had to use C++ in the glue layer to the engine. Using the Cocos2D-X game engine, for mobile ...


Only top voted, non community-wiki answers of a minimum length are eligible