D
D
Denis Nikolaev2013-12-13 06:30:27
Programming
Denis Nikolaev, 2013-12-13 06:30:27

Learning C++ Programming

I'm learning C++ (from scratch, =)), downloaded a book, read about this and that, got to the example. I type an example in the editor, save primer.cpp - errors got in, looked at everything carefully, found errors, fixed them. Then came the errors of this type. For example: the book says
#include <iostream.h>, when compiling it gives an error. I climb on the Internet and find out that now it’s true, iostreamthat is, without .h Then it gives an error on this line of code cin >> nNCelsius;, specifically on cin (that is, that cin was not declared). While looking for a reason on the Internet, I did not find it. Question: please advise the latest material on learning C++, or where to look for changes in C++ today. My book is from 2003. Thank you in advance.

Answer the question

In order to leave comments, you need to log in

6 answer(s)
F
Fat Lorrie, 2014-12-31
@SamFlynn

You may be interested in only two language standards now: the common C++03 and the modern C++11 (aka C++x0).
In addition to the book, you need to choose the right compiler, because not all of them support standards (moreover, everything is different). Support for that old mess with mandatory header files with ".h" and no namespaces (namespaces) is provided by the old-school Microsoft Visual Studio 6. Subsequent versions of the studio are already C ++ 03, possibly with C ++ 11 additions. The best thing is the free GNU GCC compiler. Information can be found on the Internet, for example, about C++11:
wiki.apache.org/stdcxx/C%2B%2B0xCompilerSupport
Books are better to look for in a newer way. Not categorically the last, but still. Among the most obvious differences is the need to replace the header files from the C ++ library with equivalents to "without .h" ( iostream.h -> iostream ), and from the C library - also remove .h, but put "with" at the beginning " ( math.h -> cmath ) and accessing C++ standard library functions and types through the std::type_or_function_name namespace. There were no major changes to the fundamentals.

L
lookid, 2013-12-13
@lookid

How did you all fool me. Languages ​​like C++ C Prolog and the like are not taught separately. They are taught as a necessity in the subject area. There is nothing to learn there: OOP, STL, pointer links. I recently had an interview in C ++, so we crossed the squares for 1.5 hours and interpolated runge-kutta. On the plus side, they asked 3-4 questions.

P
ProkletyiPirat, 2013-12-13
@ProkletyiPirat

taken from wikipedia...

// это подключает заголовочный файл iostream
#include <iostream> 
 
using namespace std; //где искать cout, cin и т.п.  гуглим что такое namespace
 
int main()
{
    cout << "Hello, world!" << endl; // можно и "...\n" вместо endl
    return 0;
}

example 2:
// это подключает заголовочный файл iostream
#include <iostream> 
 
int main()
{
    /* можно и без namespace */
    std::cout << "Hello, world!" << endl; // можно и "...\n" вместо endl
    return 0;
}

I
Ilya Evseev, 2013-12-13
@IlyaEvseev

The network has reviews of the differences of the new standard:
- en.wikipedia.org/wiki/C++0x
- sergeyteplyakov.blogspot.ru/2012/05/c-11-faq.html
- habrahabr.ru/post/182920

A
Alexander, 2013-12-13
@Nexelen

I would recommend C++ Primer Plus, 6th Edition / The C++ Programming Language. Lectures and exercises. I think it's a very good textbook. Well, or
Stroustrup B. / Stroustrup B. - The C++ Programming Language / The C++ Programming Language.

K
kvor, 2013-12-13
@kvor

I myself have tried a lot of books on C ++ ...
I highly recommend the book by Andrew Koening "Effective C ++ Programming" . Although it is from 2002, but C++ has not ceased to be C++
. I studied it, everything is very intelligible from beginning to end, there was not a single non-working example. No <*******.h> there. There is OOP STL ..
If you want to learn from scratch at a fairly acceptable level, download it. Well, you can read Stroustrup only if you already know something, from scratch I would not advise

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question