⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 coursetype.h

📁 data+structures+using+c的源码
💻 H
字号:
#ifndef H_courseType
#define H_courseType


#include <fstream>
#include <string>
using namespace std;

class courseType
{
public:
    void setCourseInfo(string cName, string cNo, 
  					   char grade, int credits);
		//Function to set the course information
  		//The course information is set according to the
		//incoming parameters.
		//Postcondition: courseName = cName; courseNo = cNo; 
  		//     courseGrade = grade; courseCredits = credits; 
 

    void print(bool isGrade);
		//Function to print the course information
  		//This function prints the course information on the 
		//screen. Furthermore, if the bool parameter isGrade is 
    	//true, the grade is shown, otherwise three stars
		//are printed.
	
    void print(ofstream& outp, bool isGrade);
		//Function to print the course information
  		//This function sends the course information to a file. 
 		//Furthermore, if the bool parameter isGrade is true, 
		//the grade is shown, otherwise three stars are printed.

    int getCredits();
		//Function to return the credit hours
		//The value of the private data member courseCredits 
		//is returned.

    void getCourseNumber(string& cNo);
		//Function to return the course number
		//Postcondition:  cNo = courseNo;

    char getGrade();
		//Function to return the grade for the course
		//The value of the private data member courseGrade
		//is returned

	bool operator==(const courseType&) const;
	bool operator!=(const courseType&) const;
	bool operator<=(const courseType&) const;
	bool operator<(const courseType&) const;
	bool operator>=(const courseType&) const;
	bool operator>(const courseType&) const;

   courseType(string cName = "", string cNo = "", 
			  char grade = '*', int credits = 0);
  		//Constructor 
		//The object is initialized according to the 
		//parameters.
		//Postcondition: courseName = cName; courseNo = cNo; 
  		//     courseGrade = grade; courseCredits = credits;

private:
    string courseName; 	//variable to store the course name
    string courseNo; 	//variable to store the course number
    char courseGrade;	//variable to store the grade
    int courseCredits;	//variable to store the grade
};

#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -