2011年C语言重修复习结合答案.docVIP

  • 7
  • 0
  • 约3.83千字
  • 约 8页
  • 2018-05-22 发布于河南
  • 举报
2011年C语言重修复习结合答案

题型 选择题(20题40分)编程题(3题39分) 判断题(6题12分) 填空题(3个空9分) 一、编程题 复习题1 编写程序代码,完成函数fun,使其计算以下分段函数,该函数的数学表达式是 #include stdio.h #include math.h #include conio.h double fun(float x) { /**/ double y; if(x0) y=x*x+1; else if(0=xx5) y=(sqrt(3*x+1)); else double y=log10(x); return(y); /**/ } void main() { float x; double y; printf(Please input a number: ); scanf(%f,x); printf(f(%.2f)=%.2f\n,x,fun(x)); getch(); } 复习题2 编写程序代码,完成函数fun1,使其计算以下分段函数,该函数的数学表达式是 #include stdio.h #include math.h double fun1(float x) { /**/ double y; if(x3) y=sin(x); else if(x==3) y=x; else y= cos(2*x+1);

文档评论(0)

1亿VIP精品文档

相关文档