Open Dev-C ++ and follow the steps below to create a Project: File-> New-> Project. The following window is displayed: select Console Application (if you want to create a GUI program, select Windows Application) and create a new file (Ctrl + n ), be sure to select Add to project (you can select Yes in the following window); otherwise, compilation will fail (Link error, I tried ). Generally, if a project has a class, it should have at least main. cpp and xxx. cpp and xxx. h among the three files, xxx is the class file name. My file is as follows: main. cpp [cpp] // main. cpp # include <iostream> # include "demo. h "/* run this program using the console pauser or add your own getch, system (" pause ") or input loop */int main (int argc, char * argv []) {demo foo1 (0); foo1.show (); return 1 ;}demo. h [cpp] // demo. h # ifndef DEMO_H _ # define DEMO_H _ class demo {private: int var1; public: demo (); Demo (int );~ Demo (); void show () ;};# endif demo. cpp [cpp] // demo. cpp # include <iostream> # include "demo. h "// constructors demo: demo () {var1 = 0x101; std: cout <" var1 = "<var1 <std: endl ;} demo: demo (int input) {this-> var1 = input;} void demo: show () {std: cout <"I am human being, you are computer ~~ \ N "<std: endl; if (0 = this-> var1) {std: cout <" error "<std: endl ;} else std: cout <"right" <std: endl; return;} demo ::~ Demo (){}