1、一、程序设计 共 113题 第 1 题 题号:319/*-【程序设计】-功能:判断 m是否为素数。-*/#include “stdio.h“void wwjt();int fun(int m)/*Program*/* End */main()int m,k=0;for(m=100;m#include#define M 3#define N 4void wwjt(); void fun(int ttMN,int ppN)/*Program*/* End */main()int tMN=22,45,56,30,19,33,45,38,20,22,66,40;int pN,i,j,k;printf(
2、“The original data is:n“);for(i=0;ippj)ppj=ttij;-第 3 题 题号:375/*-【程序设计】-功能:从键盘上输入任意实数,求出其所对应的函数值。z=e的 x次幂(x10)z=log(x+3) (x-3)z=sin(x)/(cos(x)+4)-*/#include #includevoid wwjt(); double y(float x)/*Program*/* End */main()float x;scanf(“%f“,printf(“y=%fn“,y(x);wwjt();void wwjt()FILE *IN,*OUT;int n;floa
3、t 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);-第 4 题 题号:334/*-【程序设计】-功能:求给定正整数 n以内的素数之积。 (n#include“conio.h“void wwjt(); long fu
4、n(int n)/*Program*/* End */main() int m;printf(“Enter m: “);scanf(“%d“, printf(“nThe result is %ldn“, fun(m);wwjt(); void wwjt()FILE *IN,*OUT;int c ;int t;long 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(c=1;c#inc
5、lude“conio.h“void wwjt(); long int fun(int n)/*Program*/* End */main() int m;printf(“Enter m: “);scanf(“%d“, printf(“nThe result is %ldn“, fun(m);wwjt(); void wwjt()FILE *IN,*OUT;int s ;int t;long int o;IN=fopen(“in.dat“,“r“);if(IN=NULL)printf(“Read FILE Error“);OUT=fopen(“out.dat“,“w“);if(OUT=NULL)
6、printf(“Write FILE Error“); for(s=1;s#include “math.h“void wwjt();float fun()/*Program*/* End */main()printf(“y=%fn“,fun();wwjt();void wwjt()FILE *IN,*OUT;float fOUT;IN=fopen(“19.IN“,“r“);if(IN=NULL)printf(“Please Verify The Currernt Dir.it May Be Changed“);OUT=fopen(“19.out“,“w“);if(OUT=NULL)printf
7、(“Please Verify The Current Dir. it May Be Changed“);fOUT=fun();fprintf(OUT,“%fn“,fOUT);fclose(IN);fclose(OUT);答案:-float f1=1,f2=1,f3;float r1=2,r2;dor2=r1;r1=f1/f2;f3=f1+f2;f1=f2;f2=f3;while(fabs(r1-r2)1e-4);return r1;-第 7 题 题号:394/*-【程序设计】-功能:产生 20个30,120上的随机整数放入二维数组a54中, 求其中的最小值。-*/#include “stdlib.h“