I have to do my project using C++, should I firstly read a book about that and after that write the programming, or it's better to start wtiring my code and solve my problems and questions at the same time?

Well if you have never used C++ you really should learn how to use it before you try to use it. Otherwise how do you know how to start coding the project. Have you programmed in any other languages? What is the project that you need to get done? Does it need to be console based or GUI? There are so many things you need to have mapped out before you even start writing code.

I know how to start coding the project, I worked with Fortran and Matlab, the project is simulation and modelling, and I have to do that in at least 6-7 months.

Some further questions:

  • What operating system and toolchain are you writing this for (e.g., Windows and Visual Studio, Linux and GCC, MacOS and xCode. etc.)?
  • Is this coursework for a class (I assume not, but I figured it is worth asking), a thesis or research project, or a project for an employer?
  • Are you designing the program as well as coding it, or are you working from an existing design document? Are you working as part of a team or solo?
  • What kind of simulation is it, and what are you modeling? Is the aim mainly to model the subject mathematically, or the display a simulation visually, or both? How complex is the subject to be modeled, and how many different and/or complex elements need to interact? Are the elements discrete, or do they merge or separate over the course of the simulation? Are you mainly modeling the behavior of the elements, or the relationships between them?
  • Also, to repeat NathanOliver's question, is this a console program, a graphical program, or a combination of the two? If it is a graphical program, can you write the modeling independently of the visual simulation?
  • You say you have worked in Fortran and Matlab, but you aren't familiar with C or C++, correct? Have you worked on any object-oriented designs in any other languages (e.g., Python) before? Are you familiar with general OOP principles, and are they likely to be applicable to the project? (This last question relates to some of my earlier questions about the subject; OO modeling generally works well when working with discrete, complex elements which can be categorized in a hierarchy, but works poorly with simple elements, or elements which merge or divide frequently, or when handling complex relationship data rather than behavioral data.)

I would recommend going over a basic tutorial first, and if you feel you are getting a good grip on the language from that, proceed with some experimental coding; if you find it hard to understand, hold off and get a textbook on C++ and read it in greater depth before going forward (though you should do the exercises as you go through it). The sites cplusplus.com and cprogramming.com have several good starting places you can look into. I would also suggest you familiarize yourself with OO programming, if you expect to need it.

The key to learning C++ (C with classes) is to learn how to code in C first. Then, get a grip on object-oriented design (classes, methods, etc), and then on C++ STL (Standard Template Library) tools. This is not a simple process, and will take a couple of years to master to some degree.

ruberman I would have to disagree that you have to learn C to learn C++. Saying C++ is C with classes really diminishes what C++ is. You have templates, exceptions, lambdas now, stronger type safety and a host of other features.