西工大c语言实验100题07Word格式文档下载.docx
- 文档编号:21329319
- 上传时间:2023-01-29
- 格式:DOCX
- 页数:20
- 大小:106.11KB
西工大c语言实验100题07Word格式文档下载.docx
《西工大c语言实验100题07Word格式文档下载.docx》由会员分享,可在线阅读,更多相关《西工大c语言实验100题07Word格式文档下载.docx(20页珍藏版)》请在冰豆网上搜索。
p1=p3=head;
printf("
原始表:
"
);
while(p3!
=NULL)
{
if(i==1)printf("
%.0lf"
p3->
a),i++;
elseprintf("
->
p3=p3->
q;
\n"
=NULL)
{p=p1->
while(p!
{p3=p1;
p1=p;
p=p1->
p1->
q=p3;
if(p3==head)head->
i=1;
反转表:
while(p1!
p1->
p1=p1->
return0;
}
CH1205
shortintn,f=1,i=0,a[16]={0};
%hd"
n);
if(n<
0)n=-n,f=0;
while(n!
=0)
a[i]=n%2;
n=n/2;
i++;
if(f==0)
for(i=0;
i<
16;
i++)
if(a[i]==0)a[i]=1;
elsea[i]=0;
a[0]=a[0]+1;
if(a[i]==1)break;
elsea[i]=0,a[i+1]=a[i+1]+1;
for(i=15;
i>
=0;
i--)
printf("
a[i]);
T1102
structstu
{longxh;
charname[50];
intage;
doublea[7];
doublesum;
doubleaver;
}b[10],*p;
{inti,j;
doublemax;
max=0;
10;
{b[i].sum=0;
%ld%s%d"
b[i].xh,b[i].name,&
b[i].age);
getchar();
for(j=0;
j<
7;
j++)
{scanf("
b[i].a[j]);
b[i].sum=b[i].sum+b[i].a[j];
b[i].aver=b[i].sum/7;
if(b[i].sum>
max)max=b[i].sum,p=&
b[i];
%ld%s%d"
p->
xh,p->
name,p->
age);
%.2lf"
a[i]);
T1103
typedefstructcomplex{
doubler;
doublei;
}COMPLEX;
{COMPLEXa,b;
%lf%lf"
a.r,&
a.i);
b.r,&
b.i);
(%.2lf%+.2lfi)+(%.2lf%+.2lfi)=(%.2lf%+.2lfi)\n"
a.r,a.i,b.r,b.i,a.r+b.r,a.i+b.i);
(%.2lf%+.2lfi)-(%.2lf%+.2lfi)=(%.2lf%+.2lfi)\n"
a.r,a.i,b.r,b.i,a.r-b.r,a.i-b.i);
(%.2lf%+.2lfi)*(%.2lf%+.2lfi)=(%.2lf%+.2lfi)\n"
a.r,a.i,b.r,b.i,a.r*b.r-a.i*b.i,a.i*b.r+a.r*b.i);
(%.2lf%+.2lfi)/(%.2lf%+.2lfi)=(%.2lf%+.2lfi)\n"
a.r,a.i,b.r,b.i,(a.r*b.r+a.i*b.i)/(b.r*b.r+b.i*b.i),(a.i*b.r-a.r*b.i)/(b.r*b.r+b.i*b.i));
T1105
{intxh;
structstu*p;
};
structstu*creat()
{structstu*head,*p1,*p2;
p1=(structstu*)malloc(sizeof(structstu));
%d"
xh);
if(p1->
xh==0)head=NULL;
else
head=p1;
%s%d"
name,&
xh!
{p2=p1;
xh==0)break;
p2->
p=p1;
p=NULL;
returnhead;
voidprint(structstu*p1)
{inti=1;
if(p1==NULL);
else{
for(;
p1!
=NULL;
p1=p1->
p,i++)
%d"
structstu*del(structstu*p1,intd)
{structstu*p2,*head;
xh==d)head=p1->
p;
while(p1!
if(p1!
=NULL&
&
xh==d){p2->
p=p1->
}
{structstu*p0;
intd;
p0=creat();
d);
print(p0);
p0=del(p0,d);
T1108
structlinka{
intdata;
structlinka*next;
structlinka*creat()
structlinka*p1,*p2,*head;
p1=(structlinka*)malloc(sizeof(structlinka));
data);
data!
head=p1;
elsereturnhead;
=0){
p1=(structlinka*)malloc(sizeof(structlinka));
next=p1;
next=NULL;
voidshow(structlinka*head)
if(head==NULL)return;
head!
head=head->
next){
if(head->
next==NULL){
printf("
head->
else{
%d"
staticintn=1;
staticstructlinka*pp;
structlinka*lixu(structlinka*p)//只需要完成该链表反序递归逆序即可·
·
structlinka*p1,*p2;
if(p==NULL||p->
next==NULL||(p->
next->
next==NULL&
n!
=1)){
if(p==NULL)
returnp;
pp=p->
next;
returnp;
else{
if(n==1){
n++;
p1=p->
p2=p;
p1->
next=lixu(p);
p2->
returnpp;
p=p->
returnp2;
structlinka*p;
p=creat();
p=lixu(p);
show(p);
T1109
structlian{
inti;
structlian*next;
}*head,*p1,*p2;
intj;
head=p1=(structlian*)malloc(sizeof(structlian));
head->
i);
if(head->
i==0){
head=NULL;
else
head->
i!
p1=(structlian*)malloc(sizeof(structlian));
j);
while(head!
=NULL){
i==j){
next=head;
break;
head=head->
if(p2->
next!
yes\n"
no\n"
SXK01
structclike
{inth;
structclike*next;
};
structclike*creat(void)
{structclike*head,*p1,*p2;
inti;
head=p1=p2=(structclike*)malloc(sizeof(structclike));
for(i=1;
=4;
{p2=p1;
p1=(structclike*)malloc(sizeof(structclike));
voidlist(structclike*head)
{inti=1;
next)
h),i++;
h);
intmain()
{inta[5]={101,103,105,107,109};
structclike*head,*p;
head=p=creat();
p!
p=p->
next,i++)
p->
h=a[i];
list(head);
SXK02
structclike*insert(structclike*head,structclike*xin)
{structclike*p1,*p2;
p1=head;
if(head==NULL)head=xin,xin->
{while(p1->
h<
xin->
h&
p1!
p2=p1,p1=p1->
next=xin;
if(p1!
=NULL)xin->
elsexin->
structclike*head,*p,xin;
xin.h=106;
head=insert(head,&
xin);
SXK03
structclike*delet(structclike*head,intj)
{structclike*p,*p1;
h==j)head=head->
p=p1=head;
p->
h!
=j&
p!
next=p->
head=delet(head,103);
SXK04
structlian{
structlian*next;
structlian*head;
voidnewnode(structlian*,int);
inti,age;
head=(structlian*)malloc(sizeof(structlian));
head->
i++){
newnode(head,age);
head=head->
voidnewnode(structlian*head,intage)
structlian*p1=head,*p2;
while(p1&
if(age==p1->
age){
next=p1->
return;
p1=p1->
p2=(structlian*)malloc(sizeof(structlian));
next=p2;
age=age;
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 西工大 语言 实验 100 07