1、第 1 题 (10.0 分) 题号:346功能:将两个两位数的正整数 a、b 合并形成一个整数放在 c 中。合并的方式是:将 a 数的十位和个位数依次放在 c 数的千位和十位上, b 数的十位和个位数依次放在 c 数的个位和百位上。 例如:当 a45,b=12。调用该函数后,c=4251。 #include “stdio.h“void fun(int a, int b, long *c) /*Program*/* End */main() int a,b;long c; clrscr(); printf(“Input a, b:“); scanf(“%d%d“, fun(a, b, print
2、f(“The result is: %ldn“, c);getch();NONO(); NONO ( ) FILE *rf, *wf ; int i, a,b ; long c ; rf = fopen(“in.dat“, “r“) ; wf = fopen(“out.dat“,“w“) ; for(i = 0 ; i int gcd(int n,int m)/*Program*/* End */main()int n,m,result;clrscr();scanf(“%d%d“,result=gcd(n,m);printf(“the gcd is %dn“,result);yzj();get
3、ch();yzj()FILE *IN,*OUT;int m,n;int i2;int o;IN=fopen(“in.dat“,“r“);if(IN=NULL)printf(“Read File Error“);OUT=fopen(“out.dat“,“w“);if(OUT=NULL)printf(“Write File Error“);for(n=0;n题目:从键盘输入一个大写字母,要求改用小写字母输出。char fun(char c)/*Program*/* End */void main() char c1, c2;printf(“Please input a char:“);c1=get
4、char();printf(“%c,%dn“,c1,c1);c2=fun(c1);printf(“%c,%dn“,c2,c2);wwjt();wwjt()FILE *IN,*OUT;int i;char iIN,iOUT;IN=fopen(“in.dat“,“r“);if(IN=NULL)printf(“Please Verify The Currernt DirIt May Be Changed“);OUT=fopen(“out.dat“,“w“);if(OUT=NULL)printf(“Please Verify The Current Dir It May Be Changed“);fo
5、r(i=0;i4)z=x 的八次幂(x-4)z=z=4/(x*(x+1)(x-10)z=|x|+20(其他)#include #include “stdio.h“float y(float x)/*Program*/* End */main()float x;scanf(“%f“,printf(“y=%fn“,y(x);yzj();getch();yzj()FILE *IN,*OUT;int n;float i;float o;IN=fopen(“in.dat“,“r“);if(IN=NULL)printf(“Read File Error“);OUT=fopen(“out.dat“,“w“)
6、;if(OUT=NULL)printf(“Write File Error“);for(n=0;n4) z=sqrt(x-4);else if(x-4) z=pow(x,8);else if(x-10) z=4/(x*(x+1);else z=fabs(x)+20;return(z);-第 64 题 (10.0 分) 题号:452功能:对任意输入的 x,用下式计算并输出 y 的值。-1 x0#includeint fun(int n)/*Program*/* End */void main ()int x,y;printf(“enter x:“);scanf(“%d“,y=fun(x);pri
7、ntf(“x=%d,y=%dn“,x,y);wwjt();wwjt()FILE *IN,*OUT;int i;int iIN;long int iOUT;IN=fopen(“in.dat“,“r“);if(IN=NULL)printf(“Please Verify The Currernt DirIt May Be Changed“);OUT=fopen(“out.dat“,“w“);if(OUT=NULL)printf(“Please Verify The Current Dir It May Be Changed“);for(i=0;i=0)if(n0) m=1;else m=0;else
8、 m=-1;return m;第 74 题 (10.0 分) 题号:376功能:从键盘上输入任意实数,求出其所对应的函数值。z=e 的 x 次幂(x10)z=log(x+3) (x-3)z=sin(x)/(cos(x)+4)#include #includedouble y(float x)/*Program*/* End */main()float x;scanf(“%f“,printf(“y=%fn“,y(x);yzj();getch();yzj()FILE *IN,*OUT;int n;float i;double o;IN=fopen(“in.dat“,“r“);if(IN=NULL)printf(“Read File Error“);OUT=fopen(“out.dat“,“w“);if(OUT=NULL)printf(“Write File Error“);for(n=0;n10) z=exp(x);else if(x-3) z=log(x+3);else z=sin(x)/(cos(x)+4);return(z);-