好文档 - 专业文书写作范文服务资料分享网站

C语言程序设计(谭浩强)第四版-课后答案解析

天下 分享 时间: 加入收藏 我要投稿 点赞

第一章 程序设计和C语言 【第15页】 1-5

#include <> int main ( )

{ printf (\ printf(\ Very Good!\\n\\n\

printf (\ return 0; }

1-6

#include <> int main() {int a,b,c,max;

printf(\ scanf(\ max=a; if (max

printf(\ return 0; }

第2章算法——程序的灵魂 【第36页】暂无答案

第3章最简单的C程序设计——顺序程序设计 【第82页】

3-1

#include <> #include <> int main() {float p,r,n; r=; n=10;

p=pow(1+r,n); printf(\ return 0; }

3-2-1

#include <> #include <> int main()

{float r5,r3,r2,r1,r0,p,p1,p2,p3,p4,p5; p=1000; r5=; r3=; r2=; r1=; r0=;

p1=p*((1+r5)*5); #include <> #include <> int main()

{float d=300000,p=6000,r=,m; m=log10(p/(p-d*r))/log10(1+r); printf(\ return 0; } 3-4

#include <> int main() {int c1,c2; c1=197; c2=198;

printf(\ printf(\,c2=%d\\n\ return 0; }

3-5

#include <> int main() {int a,b; float x,y; char c1,c2;

scanf(\ scanf(\ scanf(\

printf(\ return 0; } 3-6

#include <> int main()

{char c1='C',c2='h',c3='i',c4='n',c5='a'; c1=c1+4; c2=c2+4; c3=c3+4; c4=c4+4; c5=c5+4;

printf(\ return 0; }

3-7

#include <> int main ()

{float h,r,l,s,sq,vq,vz; float pi=;

printf(\请输入圆半径r,圆柱高h∶\

scanf(\ #include <> int main() { int x,y;

printf(\输入x:\ scanf(\

if(x<1) /* x<1 */ { y=x;

printf(\ y=x=%d\\n\ }

else if(x<10) /* 1==10 */ { y=3*x-11; printf(\ y=3*x-11=%d\\n\ }

return 0; }

4-7-1

#include <> int main() {

int x,y;

printf(\ scanf(\ y=-1; if(x!=0) if(x>0) y=1; else

y=0;

printf(\ return 0; }

4-7-2

#include <> int main() {

int x,y;

printf(\ scanf(\ y=0; if(x>=0)

if(x>0) y=1; else y=-1;

printf(\ return 0; } 4-8

#include <> int main()

{ float score; char grade;

printf(\请输入学生成绩:\

scanf(\

while (score>100||score<0) {printf(\输入有误,请重输\ scanf(\ }

switch((int)(score/10)) {case 10: case 9: grade='A';break; case 8: grade='B';break; case 7: grade='C';break; case 6: grade='D';break; case 5: case 4: case 3: case 2: case 1: case 0: grade='E'; }

printf(\成绩是 %,相应的等级是%c\\n \ return 0; } 4-9

#include <> #include <> int main() {

int num,indiv,ten,hundred,thousand,ten_thousand,place; return 0; } 5-6

#include <> int main()

{double s=0,t=1; int n;

for (n=1;n<=20;n++) {

t=t*n; s=s+t; }

.=%d\\n\

C语言程序设计(谭浩强)第四版-课后答案解析

第一章程序设计和C语言【第15页】1-5#includeintmain(){printf(\printf(\VeryGood!\\n\\n\printf(\return0;}1-6#includeintmain(){int
推荐度:
点击下载文档文档为doc格式
3dmu61uzg85s23r4b01m9s4tl8lgyq00e2e
领取福利

微信扫码领取福利

微信扫码分享