这是一个疯狂的错误,给我带来了很多麻烦。
#include <iostream>
using namespace std;
class Book {
private:
int bookid;
char bookname[50];
char authorname[50];
float cost;
public:
void getinfo(void) {
for (int i = 0; i < 5; i++) {
cout << "Enter Book ID" <<endl;
cin >> bookid;
cout << "Enter Book Name" << endl;
cin >> bookname;
cout << "Enter Author Name" << endl;
cin >> authorname;
cout << "Enter Cost" << endl;
cin >> cost;
}
}
void displayinfo(void);
};
int main()
{
Book bk[5];
for (int i = 0; i < 5; i++) {
bk[i].getinfo();
}
void Book::displayinfo() {
for(int i = 0; i < 5; i++) {
cout << bk[i].bookid;
cout << bk[i].bookname;
cout << bk[i].authorname;
cout << bk[i].cost;
}
}
return 0;
}
错误,如标题中所述,是在'}'标记之前的预期声明在主
行中的虚空Book :: displayinfo()在输入结束时
也会出现此错误。}'答案 0 :(得分:4)
将功能定义var a = document.forms["sendform"]["mobile"].value
移出var a = document.forms["sendform"]["rv_mobile"].value
。
除此之外,我还有一些建议。像这样更新你的类定义
void Book::displayinfo(){}