题目详情
当前位置:首页 > 职业培训考试
题目详情:
发布时间:2024-08-30 18:25:27

[单项选择]第48~50题基于以下信息。以下程序的功能是:建立一个带有头结点的单向链表,并将存储在数组中的字符依次转储到链表的各个结点中,请从与下划线处号码对应的一组选若中选择出正确的选项。   #include   stuct node   { char data; struct node *next;};    (48) CreatList(char *s)   { struct node *h,*p,*q);    h=(struct node *)malloc(sizeof(struct node));    p=q=h;    while(*s!=’’/0’’)    { p=(struct node *)malloc(sizeof(struct node));    p->data= (49) ;    q->next=p;    q= (50) ; s++;    }    p->next=’’/0’’;    return h;   }   main( )   { char str[ ]="link list";    struct node *head;    head=CreatList(str);    ...   }
A. char *
B. struct node
C. struct node*
D. char

更多"第48~50题基于以下信息。以下程序的功能是:建立一个带有头结点的单向"的相关试题:

[单项选择]第48~50题基于以下信息。以下程序的功能是:建立一个带有头结点的单向链表,并将存储在数组中的字符依次转储到链表的各个结点中,请从与下划线处号码对应的一组选若中选择出正确的选项。   #include   stuct node   { char data; struct node *next;};    (48) CreatList(char *s)   { struct node *h,*p,*q);    h=(struct node *)malloc(sizeof(struct node));    p=q=h;    while(*s!=’/0’)    { p=(struct node *)malloc(sizeof(struct node));    p->data= (49) ;    q->next=p;    q= (50) ; s++;    }    p->next=’/0’;    return h;   }   main( )   { char str[ ]="link list";    struct node *head;    head=CreatList(str);    ...   }
A. char *
B. struct node
C. struct node*
D. char
[简答题]【说明】 以下程序的功能是设计一个栈类stack<T>,并建立一个整数栈。 【程序】 #include < iostream. h > #include < stdlib. h > const int Max =20; //栈大小 template < class T > class stack{ //栈元素数组 T s[Max]; //栈顶下标 int top; public: stack( ) { top =-1; //栈顶初始化为-1 } void push( const T &item); //item入栈 T pop( ); //出栈 int stackempty( ) const; //判断栈是否为 }; template < class T > void stack <T >::push(const T &item) { if(top== (1) ) { cout <<"栈满溢出" <<endl; exit(1); } top ++ s[top] = item; } template < class T > T stack<T> ::pop( ) { T temp; if(top== (2) ) { cout <<"栈为空,不能出栈操作" < < endl; exit(1); } temp =s[top]; top --; return temp; } template < class T > int stack < T >:: stackempty( ) const { return top == -1; { void main( ) { stack <int> st; int a[] ={1,2,3,4,5}; cout <<"整数栈" <<e
[简答题]【说明】
以下程序的功能是设计一个栈类stack<T>,并建立一个整数栈。
【程序】
#include < iostream. h >
#include < stdlib. h >
const int Max =20; //栈大小
template < class T >
class stack //栈元素数组
T s[Max]; //栈顶下标
int top;
public:
stack( )

top =-1; //栈顶初始化为-1

void push( const T &item); //item入栈
T pop( ); //出栈
int stackempty( ) const; //判断栈是否为
;
template < class T >
void stack <T >::push(const T &item)

if(top== (1) )

cout <<"栈满溢出" <<endl;
exit(1);

top ++
s[top] = item;

template < class T >
T stack<T> ::pop( )

T temp;
if(top== (2) )

cout <<"栈为空,不能出栈操作" < < endl;
exit(1);

temp =s[top];
top --;
return temp;

template < class T >
int stack < T >:: stackempty( )
[填空题]以下程序的功能是建立一个带有头结点的单向链表,链表结点中的数据通过键盘输入,当输入数据为-1时,表示输入结束(链表头结点的data域不放数据,表空的条件是ph->next==NULL),请填空。
#include <stdio.h>
struct list int data;struct list *next;;
struct list *creatlist( )
struct list *p,*q,*ph;int a;ph=(struct list*)malloc(sizeof(struct list));
p=q=ph;printf("Input an integer number;entre-1 to end:/n");
scanf("%d",&a);
while(a!=-1)
p=(struct list*)malloc(sizeof(struct list));
______=a;q->next=p;______=p;scanf("%d",&a);
p->next=’/0’;return(ph);
main( )
stuct list * head;head=creatlist( );
[简答题]系统功能语法的建立基于以下两个事实:
(1)语言的使用者实际上是在一组系统中进行选择,并且努力在社会的相互作用中实现不同的语义功能;
(2)语言在人类的社会活动紧密联系,不可分离。
请就此进行简评并讨论系统功能语法与乔姆斯的转换生成语法的主要区别。
[填空题]以下程序的功能是建立—个带有头结点的单向链表,链表结点中的数据通过键盘输入,当输入数据为-1时,表示输入结束(链表头结点的data域不放数据,表空的条件是ph->next==NULL),请填空。 #include<stdio.h> struct list { int data;struct list *next;}; struct list * creatlist( ) { struct list *p,*q,*ph;int a;ph=(struct list *)malloc(sizeof(struct list)); p=q=ph;printf("Input an integer number;entre-1 to end:/n"); scanf("%d",&a); while(a!=-1) { p=(struct list*)malloc(sizeof(struct list)); [14] =a;q->next=p; [15] =p;scanf("%d",&a);} p->next=’/0’;return(ph);} main( ) {stuct list * head;head=creatlist( );}
[单项选择]以下程序的功能是:建立一个带有头结点的单向链表,并将存储在数组中的字符依次转储到链表的各个结点中,请从与下画线处号码对应的一组选项中选择正确的选项。
#include <stdio.h>
struct node
char data; struct node *next; ;
(48) CreatList(char *s)
struct node *h, *p, *q;
h=(struct node *)malloc(sizeof(struct node));
p=q=h;
while (*s!=’/0’ )
p=(struct node *)malloc(sizeof(struct node));
p->data= (49) ;
q->next=p;
q= (50) ;
s++;

p->next=’/0’;
return h ;

main( )
char str[]="link list";
struet node *head ;
head=CreatList(str) ;



A. char *
B. stmct node
C. struct node*
D. char
[单项选择]以下程序的功能是:建立一个带有头结点的单向链表,并将存储在数组中的字符依次转存到链表的各个结点中,请填空。
#include <stdlib.h>
stuct node
char data; struet node * next; ;
stntct node * CreatList(char * s)
struet node *h,*p,*q;
h = (struct node * ) malloc(sizeof(struct node) );
p=q=h;
while( * s! =’/0’)
p = (struct node *) malloc ( sizeof(struct node) );
p - > data = ( )
q- >next=p;
q=p;
a++;
p- > next =’/0’;
return h;

main( )
char str[ ]= "link list";
struet node * head;
head = CreatList(str);
A. *s
B. s
C. *s++
D. (*s)++

我来回答:

购买搜题卡查看答案
[会员特权] 开通VIP, 查看 全部题目答案
[会员特权] 享免全部广告特权
推荐91天
¥36.8
¥80元
31天
¥20.8
¥40元
365天
¥88.8
¥188元
请选择支付方式
  • 微信支付
  • 支付宝支付
点击支付即表示同意并接受了《购买须知》
立即支付 系统将自动为您注册账号
请使用微信扫码支付

订单号:

截图扫码使用小程序[完全免费查看答案]
请不要关闭本页面,支付完成后请点击【支付完成】按钮
恭喜您,购买搜题卡成功
重要提示:请拍照或截图保存账号密码!
我要搜题网官网:https://www.woyaosouti.com
我已记住账号密码