编译出错,大家帮忙看看
1>d:\竹林晚风\documents\visual studio 2008\projects\qqq\qqq\qqq.cpp(54) : error C2109: 下标要求数组或指针类型
1>d:\竹林晚风\documents\visual studio 2008\projects\qqq\qqq\qqq.cpp(54) : error C2228: “.output”的左边必须有类/结构/联合
#include "stdafx.h"
#include<iostream>
using namespace std;
class Book
{
private:
char name[100];
char num[20];
char abstracts[100];
public:
void input()
{
cout<<"Please input the name of the book:"<<endl;
cin>>name;
cout<<"Please input the num of the book:"<<endl;
cin>>num;
cout<<"Please input the abstract of the book:"<<endl;
cin>>abstracts;
}
void output()
{
cout<<"The name of the book is :"<<name<<endl;
cout<<"The num of the book is :"<<num<<endl;
cout<<"The abstract of the book is :"<<abstracts<<endl;
}
};
class Student
{
private:
char name[100];
char ID[50];
Book a[5];
public:
void inputs()
{
cout<<"Please input the name of the student :"<<endl;
cin>>name;
cout<<"Please input the ID of the student :"<<endl;
cin>>ID;
}
void inputb(int i)
{
a[i].input();
}
void outputs (int a)
{
cout<<"The name of the student is :"<<name<<endl;
cout<<"The ID of the student is:"<<ID<<endl;
for (int j=0;j<a;j++)
{
a[j].output();
}
}
};
int _tmain(int argc, _TCHAR* argv[])
{
Student stu;
stu.inputs ();
cout<<"Do you want to borrow a book?"<<endl;
char s;
cin>>s;
int k=0;
while (s=='Y'||s=='y')
{
stu.inputb(k);
k++;
if(k==5)
{
cout<<"you can't borrow a book more!"<<endl;
break;
}
}
cout<<"The massage you inputed are:"<<endl;
stu.outputs (k);
return 0;
}