Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
C++ is a popular programming language because its powerful, fast, easy to use, standardized, and more. Whether you are new to C++ programming or an advanced user, check out the following information on C++ mistakes, header files, and syntax. All information pertains to Windows, Mac, and Linux computers.
Include <string> if youre going to be using the string class. Include <iostream> when you want to use cout and cin. Include <fstream> when you want to read or write files. Include <iomanip> if you want advanced manipulator usage in your streams. Include <stdlib.h> for general operations, including system(PAUSE).
Heres a base class and a derived class: class MyBase { private: // derived classes can // not access this int a; protected: // derived classes can // access this int b; }; class Derived : public MyBase { public: void test() { b = 10; } }; Heres a function, a function pointer type, and a pointer to the function: int function(char x) { return (int)x; } typedef int (* funcptr)(char); funcptr MyPtr = function; And heres a class template and then a class based on the template: template <typename T> class MyTemplate { public: T a; }; MyTemplate<int> X;