C/C++ Programming Advice Needed (in Off-topic)

SNK3R May 23 2007 9:12 PM EDT

I've signed up for an upper division physics computational laboratory class. The instructor dictates he will be using the C/C++ language. However, I only know a bit of Java, so I'm at a loss with the C/C++.

I'm interested in self-learning C or C++ by the end of the summer so I will be prepared when time comes for the class in the fall. If you're a C/C++ programmer, what book(s) or instruction material(s) do you suggest for self-learning? Do you prefer C or C++? Why or why not? Also, what editor do you use? Feel free to add in any additional comments/suggestions you feel are necessary.

Thanks for your time.

QBOddBird May 23 2007 9:14 PM EDT

Self-learning it beforehand is a *great* idea.

As for what book to use, preference, etc - I have none, as I absolutely hated every minute of learning C++. I thought it was the most godawful language ever.

Good luck though, as I have a few friends who *do* like it. ^_^

lostling May 23 2007 9:18 PM EDT

i use visual studios 8 i think :X at least thats what the school gives...
C# would be a better language to learn as you would be able to do more web based stuff with it... or perhaps java... C is mostly for machine language base(meaning output to a physical machine0.... C++ is really similiar to C# as it is more web oriented... well books(waste of money) and materials(get from net)? ^^ google

AdminQBnovice [Cult of the Valaraukar] May 23 2007 9:28 PM EDT

As a wanna-be code hacker (sh scripts do not normally qualify as non-trivial hacks), I can say with all the ignorance and bias in my bones that learning C is a really good idea. You'll find yourself welcome to the party with all the really cool kids, and have a chance to at least be able to read system level code. It doesn't surprise me that for a class of this level that they use (and I deserve to be flamed to death for this word) real languages, and I hope one day to be able to join you in partaking of the joy of programming C.

The last time I went out looking for tutorials I know I found at least a few really robust full semester style classes online available to anyone with the inclination, I'm sure some of the cool kids who honor us by playing CB can suggest specific ones.

Oh and VI FTW!

AdminJonathan May 24 2007 12:19 AM EDT

Fortunately someone in the physics department is unlikely to explore the dark, scary corners of C++. And there are a _lot_ of such corners.

I've heard good things about "How to think like a computer scientist" and "Thinking in C++," both available for free online IIANM.

I would ask the instructor about C vs C++. You can use C++ as "not much more than C with classes" but few people do.

muon [The Winds Of Fate] May 24 2007 1:50 AM EDT


Well, if you know Java, then you know the syntax of C/C++ (the syntax of Java was specifically designed to be very similar to C/C++ so that developers wouldn't feel lost when learning Java) - things like conditional expressions, boolean and arithmetic operators etc are all the same.

But, I suggest you learn C first. The reason: it is simple. It is a very small language (C++ has a heap of operators and whatnot that C doesn't have) and if you know Java, then you are already familiar with the OO principles that C++ has on top of "normal" C.
If you must use C++, then I suggest that you don't use "plain" C++ since it can be difficult to develop anything interesting straight away. Instead, use something like Trolltech's Qt library - it is free for personal use or open source software (I think, better read the exact terms in case ;-), has a beautifully documented API with a ton of interesting examples; basically, it makes learning C++ a breeze.

I prefer C (but then I don't do any graphics/digital signal processing or anything that requires FFT - I'm mainly into system level stuff). C++ is ugly, but fast and powerful. It is mainly used for digital signal processing, graphics and other areas where FFT's and the like are used. And, of course, graphical user interfaces are all designed in OO languages these days.

Editors that I use: I mainly develop on my linux box at home, so I use gedit or nedit - both of those have syntax highlighting for a bunch of different languages, line numbering, indenting and whatnot. If you don't have X, VIM is good too, although it can be hard to get the hang of (and don't even bother trying to learn emacs if you can't handle vi ;-)

If you're on windows, then get a free version of Programmer's Notepad, or maybe Bloodshed C++ (it's an IDE, not just an editor, but a nice small one).

Books: Kernighan and Ritchie - The C Programming Language.

It is almost necessary, just as a reference.
Then, the most important thing to do is to start programming.

Do something that you enjoy. Are you interested in network programming? Using Qt, you can come up with a basic chat client and server (fully graphical) in just a couple of hours. The examples are great. Using C, and some googling, you can come up with a command line chat client and server in a small amount of time too; although be warned that there is far more micromanagement involved than in Java or in Qt's C++ api.

Some links to some Qt examples and tutorials - you don't need a textbook to learn C++, you just need the Trolltech docs:

Hmm, well have fun ;-)
This thread is closed to new posts. However, you are welcome to reference it from a new thread; link this with the html <a href="/bboard/q-and-a-fetch-msg.tcl?msg_id=0027Jt">C/C++ Programming Advice Needed</a>