#include<iostream>
using namespace std;
class book{
public:
book(int q,int p)
{
qu=q;price=p;
}
int accumulate()
{
return(qu*price);
}
private:
int qu,price;
};
int main()
{
book bo[5]={
book(1,10),
book(2,20),
book(3,30),
book(4,40),
book(5,50)};
book *p;
p=&bo[4];
for(int i=0;i<5;i++,p--)
{
cout<<"The accumulate is "<<(*p).accumulate()<<endl;
}
return 0;
}
4.20
最新推荐文章于 2016-04-20 20:29:53 发布