您的当前位置:首页正文

第14次课作业

2021-11-05 来源:易榕旅网


#include int c1,c2,c3; void fun(long n) {c1 = c2 = c3 = 0; while (n) {

/**********found**********/ switch(___1___) {

/**********found**********/ case 1: c1++;___2___; /**********found**********/ case 2: c2++;___3___; case 3: c3++; }

n /= 10; } }

main()

{long n=123114350L; fun(n);

printf(\"\\nThe result :\\n\");

printf(\"n=%ld c1=%d c2=%d c3=%d\\n\}

#include

int fun(unsigned n, int *zero) {int count=0,max=0,t; do

{t=n%10;

/**************found**************/ if(t=0) count++;

if(max/**************found**************/ zero=count; return max; }

main()

{unsigned n; int zero,max;

printf(\"\\nInput n(unsigned): \"); scanf(\"%d\ max = fun(n,&zero);

printf(\"\\nThe result: max=%d zero=%d\\n\}

#include double fun(int n) { }

NONO()

{/* 请在此函数内打开文件,输入测试数据,调用 fun 函数,输出数据,关闭文件。 FILE *rf, *wf ; int n, i ; double s ; rf = fopen(\"in.dat\ wf = fopen(\"out.dat\ for(i = 0 ; i < 10 ; i++) { fscanf(rf, \"%d\ s = fun(n);

fprintf(wf, \"%lf\\n\ }

fclose(rf); fclose(wf); }

main()

{int n; double s;

printf(\"\\nInput n: \"); scanf(\"%d\ s=fun(n);

printf(\"\\n\\ns=%f\\n\\n\ NONO(); }

*/

#include #include

/**************found**************/ void fun(int a,int b,int c)

{if(a+b>c && b+c>a && a+c>b) { if(a==b && b==c) return 3;

else if(a==b||b==c||a==c) return 2;

/**************found**************/ else return 1 }

else return 0; }

main()

{int a,b,c,shape;

printf(\"\\nInput a,b,c: \"); scanf(\"%d%d%d\ printf(\"\\na=%d, b=%d, c=%d\\n\ shape =fun(a,b,c);

printf(\"\\n\\nThe shape : %d\\n\}

#include #include double fun(int n) { }

NONO()

{/* 请在此函数内打开文件,输入测试数据,调用 fun 函数,输出数据,关闭文件。 FILE *rf, *wf ; int n, i ; double s ; rf = fopen(\"in.dat\ wf = fopen(\"out.dat\ for(i = 0 ; i < 10 ; i++) { fscanf(rf, \"%d\ s = fun(n);

fprintf(wf, \"%lf\\n\ }

fclose(rf); fclose(wf); }

main()

{int n; double sum;

printf(\"\\n\\nInput n: \"); scanf(\"%d\ sum=fun(n);

printf(\"\\n\\nsum=%f\\n\\n\ NONO(); }

*/

因篇幅问题不能全部显示,请点此查看更多更全内容