题目 解决代码及点评 /* 36.已知有如下递推公式 求该数列的前n项.不允许使用数组. */ float fp50036(int n,float x,float y) { if (n==1) { return 1; } else if (n==2) { return x; } else { return fp50036(n-1,x,y)*(2*y-1)/y-fp50036(n-2,x,y)*(y-1)/y; } } #include <stdio.h> #…
  题目 解决代码及点评 这又是个条件函数,但是这个函数无法用switch来解决,因为switch只能用于和某条件相等情况下,而这个函数的范围是无穷的 遇到这种问题,我们还是需要用复合的if语句来解决 #include <stdio.h> #include <stdlib.h> void main() { float x; float y; printf("please input x\n"); scanf_s("%f",&x…
 题目 解决代码及点评 #include <stdio.h> #include <stdlib.h> #include <math.h> void main() { double x,y; printf("please input x"); // 提示用户输入x scanf_s("%lf",&x); /// 通过scanf_s让用户输入x的值 if (x>=0) // 如果x>=0 { y=(sin(x)+…
 题目 解决代码及点评 /************************************************************************/ /* 14. 编一个程序,读入具有5个元素的实型数组,然后调用一个函数, 递归地找出其中的最大元素,并指出它位置 */ /************************************************************************/ #include <stdio.h> #inclu…
      题目 解决代码及点评 /* 功能:已知有三个数组A,B,C,A为5行5列的二维数组,B.C为只有5个元素的一维数组,键盘输入数据的顺序如下: 23,45,6,1,-3,4,5,233,456,0,3,56,78,-56,5,6,77,8,89,9,3,6,8,9,90 请编写程序,求出A的各行之和放至数组B的相应元素中,求出数组A的各列之和放至数组C的相应元素之中. 程序的输出部分要按下边形式显示: 23 45 6 1 -3 72 4 5 233 456 0…
      题目 解决代码及点评 /* 35. 用随机函数求出10组三位正整数,每组十个数, 调用一函数打印出每组数,并编一函数求出每组中的最大数. */ #include <stdio.h> #include <stdlib.h> #define N 10 /* 打印数组 */ void printfArr(int (*a)[N]) { for (int i = 0; i < N; i++) { for (int j = 0; j < N; j…