西工大C语言终极第八季修订版Word格式.docx

上传人:b****6 文档编号:17474777 上传时间:2022-12-01 格式:DOCX 页数:23 大小:625.47KB
下载 相关 举报
西工大C语言终极第八季修订版Word格式.docx_第1页
第1页 / 共23页
西工大C语言终极第八季修订版Word格式.docx_第2页
第2页 / 共23页
西工大C语言终极第八季修订版Word格式.docx_第3页
第3页 / 共23页
西工大C语言终极第八季修订版Word格式.docx_第4页
第4页 / 共23页
西工大C语言终极第八季修订版Word格式.docx_第5页
第5页 / 共23页
点击查看更多>>
下载资源
资源描述

西工大C语言终极第八季修订版Word格式.docx

《西工大C语言终极第八季修订版Word格式.docx》由会员分享,可在线阅读,更多相关《西工大C语言终极第八季修订版Word格式.docx(23页珍藏版)》请在冰豆网上搜索。

西工大C语言终极第八季修订版Word格式.docx

if(top==NULL){top=rare=f;

else

{

rare->

next=f;

rare=f;

}

}

intmain()

Listlst;

inta,c;

charb[12];

Student*pp;

do

cin>

>

a;

if(a==0)break;

b>

c;

lst.push(a,b,c);

while

(1);

pp=lst.top;

while(pp!

=NULL)

cout<

<

pp->

t<

"

"

;

pp=pp->

next;

endl;

while(pp!

if(pp->

t!

=a)cout<

return0;

72

 

73

#include<

stdio.h>

stdlib.h>

voidcheng(chara[],charb[])

inti,j,ca,cb,*s;

ca=strlen(a);

cb=strlen(b);

s=(int*)malloc(sizeof(int)*(ca+cb));

for(i=0;

i<

ca+cb;

i++)s[i]=0;

ca;

i++)

for(j=0;

j<

cb;

j++)

s[i+j+1]+=(a[i]-'

0'

)*(b[j]-'

);

for(i=ca+cb-1;

i>

=0;

i--) 

if(s[i]>

=10)

s[i-1]+=s[i]/10;

s[i]%=10;

i=0;

while(s[i]==0)i++;

for(;

i++)printf("

%d"

s[i]);

printf("

\n"

free(s);

chara[100],b[100];

gets(a),gets(b);

if(a[0]=='

-'

&

b[0]!

='

printf("

-"

cheng(&

a[1],b);

elseif(a[0]=='

b[0]=='

a[1],&

b[1]);

elseif(a[0]!

cheng(a,&

else

cheng(a,b);

return0;

74

75

intlen1,len2;

intre[105];

voidsub(chars1[],chars2[])

inti=0;

intj;

while

(1) 

if(s1[i]=='

i++;

else 

j=i;

break;

for(;

len2;

i++) 

s1[i]=s1[i]-s2[i]+'

for(i=len2-1;

j;

if(s1[i]<

'

) 

s1[i]+=10;

s1[i-1]--;

voidchu(chars1[],chars2[]) 

intp,i;

len1=strlen(s1);

len2=strlen(s2);

if(len1<

len2||(len1==len2&

strncmp(s1,s2,len2)<

0)) 

0\n"

return;

p=0;

re[p]=0;

while(strncmp(s1,s2,len2)>

=0)

sub(s1,s2);

re[p]++;

p++;

if(len1==len2) 

s2[i+1]=s2[i];

s2[0]='

len2++;

s2[len2]='

\0'

i=0;

if(re[i]==0) 

p;

re[i]);

}

intmain(void)

chars1[105];

chars2[105];

gets(s1),gets(s2);

if(s1[0]=='

s2[0]!

chu(&

s1[1],s2);

elseif(s1[0]=='

s2[0]=='

s1[1],&

s2[1]);

elseif(s1[0]!

chu(s1,&

chu(s1,s2);

76

#definemax(a,b)a>

b?

a:

b

#definemin(a,b)a>

b:

a

intsum[101];

voidjia(chara[],charb[])

intflag=0,i,len1,len2,lenmax,lenmin;

len1=strlen(a),len2=strlen(b);

lenmax=max(len1,len2),lenmin=min(len1,len2);

for(i=1;

=lenmax;

if(i<

=lenmin)

sum[lenmax-i]=a[len1-i]+b[len2-i]-'

+flag;

if(sum[lenmax-i]>

sum[lenmax-i]=sum[lenmax-i]-10;

flag=1;

 

elseflag=0;

else{

if(len1>

len2)

sum[lenmax-i]=a[len1-i]-'

if(sum[lenmax-i]>

sum[lenmax-i]=sum[lenmax-i]-10;

flag=1;

sum[lenmax-i]=b[len2-i]-'

if(flag==1)

1"

for(i=0;

lenmax;

sum[i]);

voidjian(chara[],charb[])

intflag=0,i;

=len1;

=len2)

if(a[len1-i]-b[len2-i]-flag>

=0)

sum[len1-i]=a[len1-i]-b[len2-i]-flag;

flag=0;

sum[len1-i]=a[len1-i]-b[len2-i]-flag+10;

if(a[len1-i]-flag-'

sum[len1-i]=a[len1-i]-flag-'

sum[len1-i]=a[len1-i]-flag+10-'

for(i=0;

len1&

sum[i]==0;

i++);

len1;

voidcompare(chara[],charb[])

if(len1>

strcmp(a,b)>

0))

jian(a,b);

elseif(strcmp(a,b)!

jian(b,a);

gets(a);

gets(b);

compare(b,&

a[1]);

jia(&

compare(a,&

jia(a,b);

77

chara[10];

intn,b=0,c[250]={0},i,j,x;

c[249]=1;

scanf("

%s%d"

a,&

n);

a[i]!

if(a[i]=='

.'

x=i;

continue;

b=b*10+a[i]-'

x=i-x-1;

for(i=1;

n+1;

for(j=0;

250;

c[j]*=b;

for(j=249;

j>

j--)

if(c[j]>

c[j-1]+=c[j]/10;

c[j]%=10;

if(x==0)

c[i]==0;

for(;

c[i]);

0."

for(i=250-n*x;

250-n*x;

."

78

79

80

81.大数减法

compare(&

b[1],&

jia(a,&

compare(a,b);

82

83

84

85

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 求职职场 > 简历

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1