程序填空_4
作者:互联网
源程序:
#include <iostream>
using namespace std;
class toy
{
private:
int num,price;
public:
toy(int q,int p)
{
num=q;
price=p;
}
int get_num()
{
return num;
}
int get_price() //程序填空
{
return price;
}
};
int main()
{
toy op[2][2]={toy(10,20),toy(30,48),toy(50,68),toy(70,80)};
int i;
for(i=0;i<2;i++)
for(int j=0;j<2;j++) //程序填空
{
cout<<op[i][j].get_num()<<",";
cout<<op[i][j].get_price()<<"\n";
}
return 0;
}
结果:
标签:toy,return,int,price,程序,num,填空 来源: https://www.cnblogs.com/duanqibo/p/15971246.html