c第三章课后习题答案谭浩强Word文档格式.docx
- 文档编号:16769096
- 上传时间:2022-11-26
- 格式:DOCX
- 页数:15
- 大小:16.46KB
c第三章课后习题答案谭浩强Word文档格式.docx
《c第三章课后习题答案谭浩强Word文档格式.docx》由会员分享,可在线阅读,更多相关《c第三章课后习题答案谭浩强Word文档格式.docx(15页珍藏版)》请在冰豆网上搜索。
sq<
vq="
vq<
vz="
vz<
return0;
}
intmain()
{floatc,f;
请输入一个xx:
f;
c=*(f-32);
score;
switch(int(score/10))
{case10:
case9:
grade='
A'
break;
case8:
B'
case7:
C'
case6:
D'
default:
grade='
E'
scoreis"
score<
gradeis"
grade<
{longintnum;
intindiv,ten,hundred,thousand,ten_thousand,place;
/*分别代表个位,十位,百位,千位,万位和位数
*/
enteraninteger(0~99999):
num;
if(num>
9999)
place=5;
elseif(num>
999)
place=4;
99)
place=3;
9)
place=2;
elseplace=1;
place="
place<
.="
sn<
{floats=0,t=1;
intn;
for(n=1;
n<
=20;
n++)
{
t=t*n;
.+20!
="
{inti,j,k,n;
narcissusnumbersare:
for(n=100;
1000;
{i=n/100;
j=n/10-i*10;
k=n%10;
if(n==i*i*i+j*j*j+k*k*k)
"
intmain()
{constintm=1000;
.,k10
{case1:
k1=i;
else
isnotaprime."
intprime(intn)
{intflag=1,i;
for(i=2;
i<
n/2&
&
flag==1;
i++)
if(n%i==0)
flag=0;
return(flag);
{intfac(int);
inta,b,c,sum=0;
entera,b,c:
a>
b>
c;
sum=sum+fac(a)+fac(b)+fac(c);
a<
!
+"
b<
c<
sum<
intfac(intn)
{intf=1;
for(inti=1;
=n;
f=f*i;
returnf;
cmath>
{doublee(double);
doublex,sinh;
enterx:
x;
sinh=(e(x)+e(-x))/2;
sinh("
x<
)="
sinh<
doublee(doublex)
{returnexp(x);
{doublesolut(double,double,double,double);
doublea,b,c,d;
inputa,b,c,d:
c>
d;
x="
solut(a,b,c,d)<
doublesolut(doublea,doubleb,doublec,doubled)
{doublex=1,x0,f,f1;
do
{x0=x;
f=((a*x0+b)*x0+c)*x0+d;
f1=(3*a*x0+2*b)*x0+c;
x=x0-f/f1;
while(fabs(x-x0)>
=1e-5);
return(x);
{voidgodbaha(int);
inputn:
n;
godbaha(n);
voidgodbaha(intn)
{intprime(int);
inta,b;
for(a=3;
=n/2;
a=a+2)
{if(prime(a))
{b=n-a;
if(prime(b))
intprime(intm)
{inti,k=sqrt(m);
for(i=2;
=k;
if(m%i==0)break;
if(i>
k)return1;
elsereturn0;
{intx,n;
floatp(int,int);
inputn&
x:
n>
n="
x="
P"
(x)="
p(n,x)<
}}return0;
floatp(intn,intx)
{if(n==0)
return
(1);
elseif(n==1)
return(((2*n-1)*x*p((n-1),x)-(n-1)*p((n-2),x))/n);
{voidhanoi(intn,charone,chartwo,charthree);
intm;
inputthenumberofdiskes:
m;
Thestepsofmoving"
m<
disks:
hanoi(m,'
'
);
voidhanoi(intn,charone,chartwo,charthree)
continuornot(Y/N)"
if(c=='
N'
||c=='
n'
)
flag=false;
{intsum_day(int,int);
intleap(intyear);
intyear,month,day,days=0;
inputdate(year,month,day):
year>
month>
day;
year<
/"
month<
days=sum_day(month,day);
数一
if(leap(year)&
month>
=3)
二
*//*调用函/*调用函数days=days+1;
isthe"
days<
thdayinthisyear."
intsum_day(intmonth,intday),tran;
tran=ch;
ciphercode:
ch<
j=0;
while(j<
=())
{if((ch[j]>
='
)&
(ch[j]<
Z'
))
tran[j]=155-ch[j];
elseif((ch[j]>
a'
z'
originaltext:
tran<
另一解
tran[j]=219-ch[j];
tran[j]=ch[j];
j++;
string>
{intj;
stringch="
IwillvisitChinanextweek."
ch[j]=155-ch[j];
ch[j]=219-ch[j];
{chars1[80],s2[40];
inti=0,j=0;
inputstring1:
s1;
inputstring2:
s2;
while(s1[i]!
\0'
i++;
while(s2[j]!
s1[i++]=s2[j++];
s1[i]='
Thenewstringis:
s1<
strcat(s1,s2);
{strings1="
week"
s2="
end"
s1="
s2="
s2<
s1=s1+s2;
{constintn=5;
inti,j;
stringstr[n],temp;
pleaseinputstrings:
for(i=0;
str[i];
n-1;
for(j=0;
j<
n-i-1;
j++)
if(str[j]>
str[j+1])
{temp=str[j];
str[j]=str[j+1];
str[j+1]=temp;
endl<
sortedstrings:
stringstr;
for(inti=0;
{cout<
pleaseinputstring:
str;
{constn=10;
inti;
chara[n],temp;
pleaseinputastring:
a[i];
n/2;
{temp=a[i];
a[i]=a[n-i-1];
a[n-i-1]=temp;
}if(str[0]=='
str<
str[i]<
题另一解
{stringa;
inti,n;
chartemp;
a;
n=();
constintn=10;
stringname[n];
intnum[n],score[n];
{inti;
voidinput_data();
input_data();
Thelistoffailed:
if(score[i]<
60)
name[i]<
num[i]<
score[i]<
voidinput_data()
for(i=0;
inputname,numberandscoreofstudent"
i+1<
name[i]>
num[i]>
score[i];
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 第三 课后 习题 答案 谭浩强
![提示](https://static.bdocx.com/images/bang_tan.gif)