写了一些没用的代码 权当练习

    xiaoxiao2025-04-09  17

    #include <stdio.h> double min(double, double); int main(void) { double x, y;

    printf("Please enter two numbers (q to quit):"); while (scanf("%lf %lf", &x, &y) == 2){ printf("The smaller number is %f.\n", min(x, y)); printf("Next two value"); }

    } double min(double n, double m){

    double mi; mi = (n > m) ? m : n; return mi;

    }

    #include <stdio.h> void cline (char, int, int); int main() { printf(“Please enter a word: \n”); cline(char, int, int); } cline (char w, int l, int hang) { int nl, nhang; while(scanf("%c %d %d", &w, &l, &hang) == 2){ for (nl = 0; nl < l; nl++) for (nhang = 0; nhang < hang; hang++) ; } }

    #include <stdio.h> double tiaohe(double, double); int main(void) { double e, d; //佛祖保佑佛祖保佑佛祖保佑 printf(“Please plesa please q to qiut\n”); printf("%f", tiaohe(e, d)); } double tiaohe (double x, double c) { double i = 0.0;

    while((scanf("%lf %lf", &x, &c)) == 2) i = 1/((1/x + 1/c)/2); return i;

    }

    #include <stdio.h> double ret(double, double); int main(void) { double a, b; printf(“Enter two number:\n”); printf(“The max would be %lf”, ret (a, b)); } double ret(double z, double s) { double rev; while ((scanf("%lf %lf", &z, &s)) == 2){ rev = (z > s ? z : s); break; } return rev; }

    #include <stdio.h> double min(double, int); int main(void) { double a; int a_1; int x = ‘-1’; printf(“This is an request order, enter two numbers plz: “); while ((scanf(”%d %lf”, &a_1, &a)) == 2) { if (a < 0){ if (a_1 % 2 == 0) printf(“It’s %lf”, min(a, a_1)); else printf(“It’s %lf”, min(a, a_1)) * x) } else printf(“It’s %lf”, min(a, a_1)); } } double min(double z, int c) { double rev = 1; for (int k = 1; k < c; k++) rev *= z; return rev; }

    #include <stdio.h> unsigned Fibonacci(unsigned n); int main(void) { unsigned a; printf(“There gonna be a Fibonacci number”); while (scanf("%d", &a) == 1){ printf(“It’s %u”, Fibonacci(a)); continue; } return 0; } unsigned Fibonacci(unsigned s) { if (s > 2) return Fibonacci(s - 1) + Fibonacci(s - 2); else return 1; }

    最新回复(0)