#include <stdio.h> // define classes in a namespace namespace Diy { class Student { public : char * name; int Age; a float Score; public : void say () { the printf ( " Age was% s% d, the results are F% \ n- " , name, Age, score); } }; } int main () { Diy :: Student STU1; stu1.name = " Bob " ; stu1.age = 15 ; stu1.score = 92.5f; stu1.say(); return 0; }
Compile
gcc -lstdg++ test.cpp
run
./a.out