tags:

views:

145

answers:

6

hey.I'm kinda expert in php and now i want to start learning c++ but i don't know where to start. i don't wanna read from beginning because I've heard that php is very similar to c and c++.anyone can help?

+1  A: 

I would start from the beginning. I started on Java which is more similar than PHP and I still made a point to read the book I had from the beginning. It's important to know the little subtleties about the language. As for resources, I have no strong opinion on any book I've seen, but I do prefer books. This is the book I started with. It got the job done, but I know my boss/professor wasn't happy with it and has since replaced it.

Kyle
+8  A: 

Start at the start. The similarities between PHP and C++ will take about half an hour to get through ("this is an object, this is a loop, ..."), and there are subtle differences which will kill you if you're not paying attention during that half hour. Learning C++ will take months to years, depending what you mean by "learn". It's just not a worthwhile optimisation.

Steve Jessop
A: 

Because you know PHP, you'll "feel at home" a little bit when you start to learn C++ because you'll be used to typing semicolons at the end of statements, using braces for conditionals, etc.

You'll likely be able to progress more quickly because you know PHP, but there are C++-only constructs and ideas that will be new. That, and though the syntaxes are similar, they're not identical.

John at CashCommons
A: 

PHP and C++ may look similar on the surface (they share a lot of lexical elements and quite a bit of syntax), but they are two very different languages. The type systems are different (C++ arrays and PHP arrays are not the same thing), the toolkits are different, etc.

Start at the beginning.

John Bode
+2  A: 

As others have said, the similarities are superficial at best. Basic C syntax is pretty much the same - loops, conditionals, etc, but the interesting parts of the language are vastly different.

This is going to be a big learning curve, but when you reach the other side you'll be a much more aware and qualified developer.

One of the big problems that I foresee is basic coding style. The majority of the PHP code that I've seen is poorly structured at best, relying on a mashup of procedural code, objects and misc. hacks. Memory management is nearly a non-issue in PHP, whereas you need to always be aware of it in C++.

Also, note that even the differences between C and C++ (there's no such thing as C/C++, despite what the book publishers seem to think) are substantial.

David Lively
A: 

I've posted a similar question, Comprehensive tutorial for beginners on how to write Windows GUI programs. Like tazphoenix, I know some PHP. I don't claim to be a PHP expert, though. I don't even claim to be an expert in Swedish or English, despite the fact that I'm a teacher in Swedish and English and have published several books in Swedish and a couple in English. I rather realise how little I know the more I learn about languages and other subjects.

I found the answers and comments above very enlightening. I've read several basic books on how to write C++ console programs, but I haven't done any C++ programming for real. Up til now, I thought PHP and C++ were more similar than they are according to the answers and comments above.

I want to learn how to write Windows GUI programs. Originally, I wanted to use C++, but because I haven't find any comprehensible tutorials on how to write C++ GUI programs I started learning C# instead a few days ago. Without knowing for sure, I think C# is easier than C++. There also seem to be more comprehensible tutorials for C# than for C++.

Since I'm a linguist, it's probably not surprising that I'm primarily interested in writing programs to handle language. At least for now; later I will most likely want to write other kind of programs as well. A few examples of what I want to know how to do:

  • Open file dialog (done)
  • Save file dialog (done)
  • Change encoding (ANSI, UTF-8, etc.)
  • Print dialog
  • Exit program (done)
  • Undo and redo dialogs
  • Cut, copy and paste dialogs
  • Making all text uppercase or lowercase
  • Etc.

I think you get the idea. If you know where I can find tutorials, with as much explanations of basic C# concepts as possible, that teaches what's mentioned in the list above or other similar things, it would be very nice if you could post some addresses here.

Thank's in advance!

matsolof