更多"以下程序中函数fun的功能是:构成一个如图所示的带头结点的单向链表,在"的相关试题:
[填空题]以下程序中函数fun的功能是:构成一个如图所示的带头结点的单向链表,在结点的数据域中放入了具有两个字符的字符串。函数disp的功能是显示输出该单链表中所有结点中的字符串。请填空完成函数
disp。
#include
typedef struct node/*链表结点结构*/
{char sub[3];
struct node * next;
}Node;
Node fun(char S) /*建立链表*/
{ ……}
void disp(Node *h)
{Node*P;
P=h->next;
while(【 】)
{printf("%s\n",P->sub);P=【 】; }
}
main( )
{Node *hd;
hd=fun( );disp(hd);prinff("\n");
}
[填空题]以下程序中函数 fun 的功能是:构成一个如图所示的带头结点的单向链表,在结点 的数据域中放入了具有两个字符的字符串。函数 disp 的功能是显示输出该单向链表 中所有结点中的字符串。请填空完成函数 disp。
head
ab cd ef /0
#include
typedef struct node /*链表结点结构*/
{ char sub[3];
struct node *next;
}Node;
Node fun(char s) /* 建立链表*/
{ …… }
void disp(Node *h)
{ Node *p;
p=h->next;
while(= _______ )
{ printf("%s/n",p->sub);p= _______ ; }
}
main( )
{ Node *hd;
hd=fun( ); disp(hd);printf("/n");
}
[填空题]以下程序中函数fun( )的功能是构成一个如图所示的带头结点的单向链表,在结点的数据域中放入了具有两个字符的字符串。函数disp的功能是显示输出该单向链表中所有结点中的字符串。请填空完成函数disp。
[*]
#include <atdio.h>
typedef struct node /*链表结点结构*/
char sub[3];
struct node * next;
Node
Node ~un(char s) /*建立链表*/
......
void disp(Node * h)
Node * Ps
p=h->next;
while( )
printf("%s//n",p->suh);p= ;
main( )
Node * hd;
hd = fun( ); disp(hd) ;prinff(" //n" );
[填空题]以下程序中,函数fun的功能是计算X的2次方-2x+6,主函数中将调用fun函数计算:
y1=(x+8)的2次方-2(X+8)+6
y2=sin2(x)一2sin(x)+6
请填空。
#include "math.h"
double fun(double X){return(X*x-2*X+6);}
main( )
{double x,yl,y2;
printf("Enter x:");scanf("%If",&x);
y1=fun(【 】);
y2=fun(【 】);
printf("y1=%If,y2=%lf\n",y1,y2);
}
[填空题]以下程序中,函数fun的功能是计算x2-2x+6,主函数中将调用fun函数计算,请填空。
y1=(x+8)2-2(x+8)+6
y2=sin2(x)-2sin(x)+6
#include "math.h"
double fun(double x) return( (8) );
main( )
( double x,y1,y2;
printf("Enter x:"); scanf("%1f",&x);
yl=fun(8+x);
y2=fun( (9) );
printf("y1 =%1f,y2=%1f/n",y1,y2);
[填空题]以下程序中函数 huiwen 的功能是检查一个字符串是否是回文,当字符串是回文时,函数返回字符串 yes!,否则函数返回字符串 no!,并在主函数中输出,所谓 回文即正向与反向的拼写都一样,例如:adgda。请填空。
#include
char *huiwen(char *str)
{ char *p1,*p2; int i,t=0;
p1=str;p2==_______ ;
for(i=0;i<=strlen(str)/2;i++)
if(*p1++!=*p2--){t=1;break;}
if(=_______ ) return("yes!");
}
main( )
else return("no!");
{ char str[50];
printf("Input:"); scanf("%s",str);
printf("%s/n",=_______ );
}