您的位置:首页 > 其它

4.20

2015-06-29 23:37 141 查看
01.#include<iostream>
02.#include<string>
03.using namespace std;
04.class book
05.{
06.public:
07.    book(int a)
08.    { qu=a;
09.      price=10*a;
10.    }
11.    void show()
12.     {
13.         cout<<qu*price<<endl;
14.     }
15.private:
16.    int qu;
17.    int price;
18.};
19.int main()
20.{
21.    book book1[5]={book(1),book(2),book(3),book(4),book(5)};
22.
23.    int i;
24.    book* p=book1;
25.    for( i=1;i<=4;i++)
26.    {
27.       p[4-i].show();
28.    }
29.        return 0;
30.}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: