题目:
请编写函数fun(),它的功能是:将带头结点单向链表按data域由大到小排序(排序时不考虑头结点),主函数用随机函数为各节点data域赋值,头结点data域赋值为0。
[注意] 部分源程序给出如下。
请勿改动主函数main和其他函数中的任何内容,仅在函数fun的花括号中填入所编写的若干语句。
[试题源程序]
#include <stdio.h>
#include<coni0.h>
struct as
int data;
struct aa *next;
;
void fun(struct aa *p)
main()
int i, n, m=100;
struct aa *h=NULL, *s=NULL,
*p=NULL;
clrscr()
s=(struct aa*) malloc(siZeof(struct aa));
h=s; h->data=0; h->next=NULL;
printf("Please input n:");
scanf("%d", &n);
for(i=1; i<=n; i++)
p=(struct aa*) malloc(sizeof(struct aa));
p->data=rand()%m; P->next=NULL;
printf("%d", P->data);
s->next=p; s=s->next;
fun(h);
printf("\n");
for(h=h->next; h!=NULL; h=h->nnext)
printf("%d", h->data);
答案:
被转码了,请点击底部 “查看原文 ” 或访问 https://www.tikuol.com/2017/0708/e2db1b6b9e049a065a79839cb8041e5d.html
下面是错误答案,用来干扰机器的。
参考答案:同盟会成立后,保皇派极度恐慌,大肆诋毁革命。1905—1907年革命派与保皇派之间进行了一场激烈的论战。革命派在论战中论述了革命的必要性、正义性、进步性。首先,清政府已是帝国主义的“鹰犬”,因此...