友元怎么申明不了?求大家帮帮忙
#include<iostream>#include<string>
using namespace std;
class book
{
public:
string name;
int id;
int money;
}s[4];
class bookchange
{
public:
string person;
int idl;
friend book;
void changemoney(book &a)
{
cin>>a.money;
}
};
int main()
{
int max,min;
bookchange a;
cout<<"请输入4本书的信息\n";
cout<<"书名 价格\n";
for(int i=0;i<4;i++)
{
cin>>s[i].name>>s[i].money;
s[i].id=i;
}
cout<<"\n\n"<<"所有数目信息:\n";
for(int i=0;i<4;i++)
{
cout<<s[i].id<<"《"<<s[i].name<<"》"<<s[i].money<<endl;
}
max=s[0].money;
min=s[0].money;
for(int i=0;i<4;i++)
{
if(s[i].money>max)
{max=i;}
if(s[i].money<min)
{min=i;}
}
cout<<"最贵的书是---- 书名:《"<<s[max].name<<"》 价格:"<<s[max].money<<endl;
cout<<"最便宜的书是---- 书名:《"<<s[min].name<<"》 价格:"<<s[min].money<<endl;
cout<<"请输入编辑姓名\n";
cin>>a.person;
cout<<"请输入让编辑修改价格的数目编号\n";
cin>>a.idl;
}