湖南工业大学c语言网上作业答案,湖南工业大学C语言考试题目.doc

253b171540df25e1b84436cbe50dfc72.gif湖南工业大学C语言考试题目.doc

1、include conio.h 改错 include stdio.h int arrmax int arr33 int i,j,max; maxarr00; /found/ for i0; i3; i 此处将1改为0,并且去掉等号 for j0; j3; j if max arrij max arrij; return max; void main int a334,4,34,7,3,12,5,6,5,i,j; /found/ printfThe max is dn,arrmaxa; 将arrmaxa00改为arrmaxa 2、define M 10 includestdio.h void main int i,a100,t; clrscr; fori0;iM;i) /found/ -scanfd, /found/ fori0;iM/2;i aM-i-1ai;fori0;iM;i printf5d,ai; printfn; 3、include conio.h 编辑 include stdio.h int funint m /*begin*/int a1,a2,a3,s;a1m/100;a2m100/10;a3m10;sa1a2a3;returns; /end/ void main int m,s; clrscr; printfEnter m n; scanfd, sfunm; printfResult is dn,s;4、include conio.h 改错 include stdio.h main int a1010,4,2,7,3,12,5,34,5,9,i,s; clrscr; s 0; /found/ for i0; i10; i 去掉等号 if ai 2 0 /found/ s s ai; 将i改为ai printfThe result is dn, s; 5、include stdio.h 填空 include conio.h void main int num,k; clrscr ; /found/ k0; 给k赋值 printfPlease enter a number ; scanfd, do /found/ kknum10 ; num10可求出num的各位 num/10; whilenum ; printfndn,k ; 6、include conio.h 改错 include stdlib.h include math.h void main int i,j,x,p; clrscr; x1; /found/ j11; 12改为11 whilej1 px1*2; /found/ xp; PX互相交换 j; printftotal is dn,p; 7、include stdio.h 改错 void main long int f201,1; int i;clrscr; /found/ f01;f11; 赋初值 fori0;i20;i fi2fifi1; 保证前面两个数要输出,所以要这样改 /found/ ifi50 printfn; i50保证一行5个数输出 printf8ld,fi; printfn; 8、include stdio.h 编辑 include math.h include stdlib.h double fundouble x /*begin*/ int q; double n,t,s; n1; s0; t1; q1; whilefabstx sst; nn2; q-q; tq/n; return s; /*end*/ void main double x,sum; printfEnter xn; scanflf, sumfunx; printfsum.4fn,sum; NONO ; 9、include conio.h 改错 include stdio.h int max; fun int arr,int n int pos,i; max arr0; pos 0; for i1; in; i if max arri max arri; /found/ pos i; I,POS互换。 return pos; void main int a101,4,2,7,3,12,5,34,5,9,n; clrscr; /found/ -n funa,10; printfThe max is d ,pos is dn, max , n; 10、include stdio.h 编辑 include math.h include conio.h include stdlib.h void main int m6,n45,t,i,temp; /*begin*/ tempn*m; whilem0 inm; nm; mi; ttemp/n; 注 此时最大公约数是n,要通过此程序会求最大公约数 最小公倍数等于两个数的乘积除以它们的最大公约数 /end/ printfThe Lowest Common Multiple of d and d is dn,m,n,t; NONOm,n,t; 11、include math.h 填空 include conio.h include stdio.h main int m,n,i,t; long int s0; clrscr; scanfd,d, if mn tm; mn; nt; /found/ for im;in;i if i30 i70 s i; /found/ printfSum is ldn,s ; 12 include stdio.h 填空 void main long s, t, sl1; int d; clrscr; printfnPlease enter s; scanfld, t 0; while s 0 d s10; /found/ if d20 判断余数 td * sl t; sl * 10; /found/ s s/10; 遇到奇数退出寻环后的处理 printfThe result is ldn, t; 13、include stdio.h 填空include string.h void main char s10; int i; long int n; clrscr; /found/ n0; 赋初值 scanfs,s; fori0;istrlens;i /found/ nn*10si-0; 将字符串转换成整数的方法 printfnldn,n; 14、include stdio.h 编辑 include math.h include stdlib.h double funint n /*begin*/double y1.0;int i;fori2;in;iy1.0/i*i;return y /end/ void main double s; int n; clrscr; printfEnter sn; scanfd, sfunn; printfs .3fn,s; NONO ; 15、一样的.16、include stdio.h 编辑 include math.h include stdlib.h double fundouble x /*begin*/跟第8题一样 这个我也不知道了 /*end*/ void main double x,sum; printfEnter xn; scanflf, sumfunx; printfsum.4fn,sum;17、include conio.h 编辑 include stdio.h int funint a33 /*begin*/ int maxa00; int i,j; fori0;i3;i forj0;j3;j ifmaxaij maxaij; /end/ void main int a331,2,3,4,9,5,7,8,6; int i,j,max; clrscr; printfarray isn; fori0;i3;i forj0;j3;j printf5d,aij; printfn; maxfuna; printfResult is dn,max; 18、include conio.h 改错 include stdio.h void main int a334,4,34,37,3,12,5,6,5,i,j,max,min; clrscr; max min a00; for i0; i3; i /found/ for j0; j3; j 将1改为0 if max aij max aij; /found/ if min aij 小于号改为大于号 min aij; printfThe max is dn, max; printfThe min is dn, min; 19、include conio.h 填空 include stdio.h double average int arr , int n int k0,i; double s; s 0; for i0 ;in; i /found/ if arri 2 1 是恒等号 s s arri; k; return s/k ; void main int a1210,4,2,7,3,12,5,34,5,9,21,18; double s; clrscr; /found/ s averagea,12; 和第一题结果类似 printfThe result is .2fn, s; 20、include stdio.h 编辑 include math.h include conio.h include stdlib.h void main int m76,n40,t,i; /*begin*/in*m; int r; whilen0 rmn; mn; nr; tm; /end/ printfThe Highest Common Divisor of d and d is dn,m,n,t; NONOm,n,t; NONO int m,int n,int t FILE *f; fDexam01700311PROGOUT.DAT,w; fprintff,Maximal Common Divisor Of d and d is dn,m,n,t; fclosef; 21、include math.h 填空 include conio.h include stdio.h long int funint x long int s1; int i; for i1;ix;i s*i; /found/ return s; void main long int m12,n2,s1,s2,s3; clrscr; s1funm; s2funn; s3funm-n; /found/ printfCmn is ld,s1/(s2*s3); 22、include stdio.h 编辑 include math.h include conio.h include stdlib.h void main int m1234,a,b,c,d; /*begin*/am10;bm100/10; 这里补充的4行是求四位数各个数位的表示方法cm1000/100;dm/1000; /end/ printfmd,d d d dn,m,a,b,c,d; NONOm,a,b,c,d; NONO x,a,b,c,d int x,a,b,c,d; FILE *f; fDexam01701219PROGOUT.DAT,w; fprintff,xd 3d3d3d3dn,x,a,b,c,d; fclosef; 23、 include math.h include conio.h include stdio.h void main int a102,3,5,7,8,9,10,11,12,13,i,j,k,count; clrscr; count 0; for i0; i10; i ksqrtai; for j2; jk; jif ai j 0 break; /found/ ifjk count; /found/printfprime numbers isare d,count;24求一维数组a中值为奇数的元素之和。列如当一维数组a中的元素为10,4,2,7,3,12,5,345,9,21,19。输出结果 改错include conio.h include stdio.h int sum int b ,int n int i,s 0; for i0; in; i if bi 2 1 /found/ s s bi return s; void main int a1210,4,2,7,3,12,5,34,5,9,21,19,n; /found/ n suma,2; printfThe result is dn,n ; 25求二维数组a中的最大值和最小值,列如,当二维数组a中的元素为4 4 34 37 3 12 5 6 5输出为max37 min3 填空 include conio.h include stdio.h void main int a334,4,34,37,3,12,5,6,5,i,j,max,min; clrscr; max min a00; for i0; i3; i /found/ for j1; j3; j if max aij max aij; /found/ if min aij min aij; printfThe max is dn, max; printfThe min is dn, min;

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
基于C++&OPENCV 的全景图像拼接 C++是一种广泛使用的编程语言,它是由Bjarne Stroustrup于1979年在新泽西州美利山贝尔实验室开始设计开发的。C++是C语言的扩展,旨在提供更强大的编程能力,包括面向对象编程和泛型编程的支持。C++支持数据封装、继承和多态等面向对象编程的特性和泛型编程的模板,以及丰富的标准库,提供了大量的数据结构和算法,极大地提高了开发效率。12 C++是一种静态类型的、编译式的、通用的、大小写敏感的编程语言,它综合了高级语言和低级语言的特点。C++的语法与C语言非常相似,但增加了许多面向对象编程的特性,如类、对象、封装、继承和多态等。这使得C++既保持了C语言的低级特性,如直接访问硬件的能力,又提供了高级语言的特性,如数据封装和代码重用。13 C++的应用领域非常广泛,包括但不限于教育、系统开发、游戏开发、嵌入式系统、工业和商业应用、科研和高性能计算等领域。在教育领域,C++因其结构化和面向对象的特性,常被选为计算机科学和工程专业的入门编程语言。在系统开发领域,C++因其高效性和灵活性,经常被作为开发语言。游戏开发领域中,C++由于其高效性和广泛应用,在开发高性能游戏和游戏引擎中扮演着重要角色。在嵌入式系统领域,C++的高效和灵活性使其成为理想选择。此外,C++还广泛应用于桌面应用、Web浏览器、操作系统、编译器、媒体应用程序、数据库引擎、医疗工程和机器人等领域。16 学习C++的关键是理解其核心概念和编程风格,而不是过于深入技术细节。C++支持多种编程风格,每种风格都能有效地保证运行时间效率和空间效率。因此,无论是初学者还是经验丰富的程序员,都可以通过C++来设计和实现新系统或维护旧系统。3

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值