c程序的问题,急需帮忙!!!不胜感激!!

来源:百度知道 编辑:UC知道 时间:2024/05/31 00:17:18
#include<iostream.h>
#include<string.h>
#include<stdio.h>
typedef struct words
{
char *w[15];
char *c[20];
struct words *next;
}W;
W *create_list()
{
//*******************create new list*********************
W *head;
head=new W;
if(head!=NULL)
cout<<"链表已建立!"<<endl;
else cout<<"not enough room!\07"<<endl;
head->next=NULL;
head->next=0;
return head;
}
//****************insert new list*********************
int insert_list(W *head,char *w[15])
{
W *a,*b,*s;
s=new W;
char *c[20];
if(s==NULL)
{
cout<<"not enough room!\07"<<endl;
return 0;
}
a=head;
b=head->next;
while(strcmp(b->w[15],w[15])<=0)
{
a=b;
b=b->next;
}
a->next=s;
s-&g

问题在这里:
while(1)
{
cout<<"the word: ";
cin>>w[15];
break;
insert_list(head,&w[15]);
}
你的目的是想在链表中插入一个字符串.
还没有执行insert_list(head,&w[15]);就跳出了.

希望对你有所帮助.