<st1:chmetcnv tcsc="0" w:st="on" unitname="C" sourcevalue="1.3" numbertype="1" negative="False" hasspace="True">1.3 C</st1:chmetcnv>++的设计
- int intVar;
- double yourCash, myCash;
- class Student;
- std::string studentName;
- int intMax(int, int);
<v:shapetype id="_x0000_t202" path="m,l,21600r21600,l21600,xe" coordsize="21600,21600" o:spt="202"><v:stroke joinstyle="miter"></v:stroke><v:path o:connecttype="rect" gradientshapeok="t"></v:path></v:shapetype><v:shapetype id="_x0000_t75" path="m@4@5l@4@11@9@11@9@5xe" coordsize="21600,21600" o:spt="75" o:preferrelative="t" filled="f" stroked="f"><v:stroke joinstyle="miter"></v:stroke><v:formulas><v:f eqn="if lineDrawn pixelLineWidth 0"></v:f><v:f eqn="sum @0 1 0"></v:f><v:f eqn="sum 0 0 @1"></v:f><v:f eqn="prod @2 1 2"></v:f><v:f eqn="prod @3 21600 pixelWidth"></v:f><v:f eqn="prod @3 21600 pixelHeight"></v:f><v:f eqn="sum @0 0 1"></v:f><v:f eqn="prod @6 1 2"></v:f><v:f eqn="prod @7 21600 pixelWidth"></v:f><v:f eqn="sum @8 21600 0"></v:f><v:f eqn="prod @7 21600 pixelHeight"></v:f><v:f eqn="sum @10 21600 0"></v:f></v:formulas><v:path o:connecttype="rect" gradientshapeok="t" o:extrusionok="f"></v:path><o:lock aspectratio="t" v:ext="edit"></o:lock></v:shapetype>
- int intVar = 0;
- double yourCash = 0.0, myCash = 10e+10;
- class myClass {}; //an empty class;
- std::string studentName(“”);
- int intVar; //declaration;
- intVar = 3; //definition;
- //class definition;
- class Student {
- int _studentNo;
- char _gender;
- std::string _birth;
- public:
- int number(void) const;
- char gender(void) const;
- std::string birth(void) const;
- };
- //a function definition/implement;
- int intMax(int a, int b) {
- return (a > b ? a : b);
- }
- int
- Student::number(void) const {
- return _studentNo;
- }
- using namespace gavin::math;
- Matrix matrix1(3, 5), matrix(5,3);
- matrix[0][0] = 3, matrix1[0][1] = 2;
- //…初始化matrix1和matrix2;
- Matrix result( matrix1 * matrix2 );
- cout << “We can print out the result: “ << result << endl;
- cout << “after multiply with 3 is: “ << 3*result << endl;
- cout << “And we can plus them: “ << matrix1 + matrix2 << endl;
- cout << “Sure can minus: “ << matrix1 – matrix2 << endl;
- cout << “Even get a negative: “ << -matrix2 << endl;
- cout << “Get the Matrix’s size: “ << matrix2.size() << endl;
- Matrix::iterator iter = result.begin(),
- iterEnd = result.end();
- for(; iter != iterEnd; ++iter) {
- cout << *iter << endl;
- }
- printMatrix(matrix1); printMatrix(matrix2);
- matrixPlus(matrix1, matrix2);