A string
字符集合 C++ 标准类库 std::string 需包含 <string>
getline 函数
读取一行输入 例: getline( cin, nameOfCourse );
© 版权所有 哈尔滨工业大学(威海)软件学院
The C++IBM research Programming Language
© 版权所有 哈尔滨工业大学(威海)软件学院
The C++IBM research Programming Language
3 Defining a Class With a Member Function
Beginning of class definition for class GradeBook class GradeBook Beginning of class body { Access specifier public; makes members public: available to the public // function that displays a welcome messagefunctionGradeBook user Member to the displayMessge void displayMessage() returns nothing { cout << "Welcome to the Grade Book!" << endl; } // end function displayMessage }; // end class GradeBook End of class body // GradeBook class definition