?? 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
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -