📄 course.h
字号:
#include <iostream>
#include <cstdlib>
#ifndef COURSE_H
#define COURSE_H
using namespace std;
int const MAX_LINES = 10;
class course {
public:
string name;
string title;
string description[MAX_LINES];
course() : name(""), title("") {}
course(string name, string title) :
name(name), title(title) {}
friend ostream& operator<<(ostream&, const course&);
friend istream& operator>>(istream&, course&);
};
ostream& operator<<(ostream& out, const course& c) {
out << c.name << ": " << c.title << "\n";
int index = 0;
while (c.description[index] != "") {
out << c.description[index++] << "\n";
}
return out;
}
istream& operator>>(istream& in, course& c) {
getline(in, c.name);
getline(in, c.title);
string line;
getline(in, line);
int number = 0;
while (line != "") {
c.description[number++] = line;
getline(in, line);
}
return in;
}
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -