65,183
社区成员




#include<iostream>
using namespace std;
struct str
{
string a;
string b;
};
class B
{
private:
int a;
struct str s[10];
public:
void sets(string str,int n=10)
{
for(int i=0;i<10;i++)
{
s[i].a=str;
s[i].b=str;
}
}
const str* gets()const{ return s; }
/* void print()
{
for(int i=0;i<10;i++)
{
cout<<"a "<<i<<s[i].a<<endl;
cout<<"b "<<i<<s[i].b<<endl;
}
}*/
};
int main()
{
B b;
b.sets("hello");
// b.print();
const str* st=b.gets();
for(int i=0;i<10;i++)
{
cout<<"a"<<i<<" "<<st[i].a<<endl;
cout<<"b"<<i<<" "<<st[i].b<<endl;
}
getchar();
return 0;
}