#include
using namespace std;
#include
struct people
{
string name;
int num;
};
template
struct Node
{
T data;
Node*next;
};
template
class LinkList
{
Node*head;
public:
LinkList();
LinkList(T a[],int n);
~LinkList();
void PrintLinkList();
};
template
LinkList::LinkList()
{
head=new Node;
head->next=NULL;
}
template
LinkList::LinkList(T a[],int n)
{
head=new Node;
rear=head;
for(i=0;i
s=new Node;
s->data=a[i];
rear->next=s;
rear=s;
}
rear->next=NULL;
}
template
void LinkList::PrintLinkList()
{
p=head->next;
while§
{
cout p=p->next;
}
}
int main()
{
int i;
string a[5]={“gh”,“hu”,“mk”,“se”,“KK”};
int b[5]={111,222,333,444,555};
people p[5];
for(i=0;i<5;i++)
{
p[i].name=a[i];
p[i].num=b[i];
cout<
}
return 0;
}
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)