#include<iostream>#include<string>using namespace std;class Book{protected: char bookname[100]; int number; char authorInformation[100];public: Book(char *booknam,int num,char *authorInfor) { strcpy(bookname, booknam); number = num; strcpy(authorInformation, authorInfor); cout << "书名:" << bookname<<endl; cout << "编号:" << number << endl; cout << "作者属性:" << authorInformation << endl; }};class Reader :public Book{private: char name[20]; int ID; char lendingInformation[100];public: Reader(char *booknam, int num, char *authorInfor, char *nam, int id, char *lendingInfor) :Book(bookname, num, authorInfor) { strcpy(name, nam); ID = id; strcpy(lendingInformation, lendingInfor); cout << "读者姓名:" << name<<endl; cout << "ID:" << id << endl; cout << "借书属性:" << lendingInformation << endl; }};int main(){ Reader r("annnn", 1005, "Jane Austen(1775-1817),English novelist", "Ann", 001, "于一月后归还"); system("pause"); return 0;}
1 回答
已采纳
这都不会
TA贡献72条经验 获得超92个赞
小伙子,因为你
public: Reader(char *booknam, int num, char *authorInfor,
这一行打错了
应该是
Reader(char *bookname
你少打了一个e
- 1 回答
- 0 关注
- 1311 浏览
添加回答
举报
0/150
提交
取消