but now another nonsense. The program from above earned, it is joyful)) now I enter the code from the book, it says that everything worked from there. in C ++ visual 2006, but it doesn't work for me in 2010. is this normal? here is an example of the way:

// Программа дважды два #include <iostream.h> int main () { cout <<"2 * 2 = " << 2*2 << endl; return 0; } 

gives a bunch of errors

    1 answer 1

    2 errors.

    First of all, I have a 2010 studio and there I don’t need to write the .h extension to standard incl files (where iostream belongs)

    Secondly, you need to write "using namespace std;" or as written in the example for userx, because for cout, cin, endl you need to specify that they are from the standard library.

    It seems something like this :).

     #include <iostream> using namespace std; int main () { cout <<"2 * 2 = " << 2*2 << endl; return 0; } 
    • Your code is being checked for errors, compiled, a window with a command line appears and after a second everything disappears, just like it never happened. - Tolya Znamenshchikov
    • I thought that it was necessary to write for the program to work. Thanks to all! - Tolya Znamenshchikov
    • You can write system ("PAUSE >> void"); and then should not close. You can experiment with cin. - Baran