include <bits/stdc++.h>#define LDB long doubleusing namespace std; LDB count(int a[]){ LDB tot=0; for (int i=0;i<10;i++) tot+=a[i]; tot/=10; return(tot); } int main(){ int arr[10]; printf("%.3Lf\n",count(arr)); } ...
include <stdlib.h> int Fun(int a[], int len);int main(){ const int MAX = 100;int a[MAX] = {2,3,7,8,9,10,13,21,24,27};int len = 10;int s = Fun(a, len);printf("%d\n", s);system("pause");return 0;} int Fun(int a[], int len){ int sum = 0;fo...
int func(int a[],int n){ int i,cnt;for(cnt=0,i=0;i<n;++i)if(a[i])cnt++;return cnt;} int main(){ int a[10]={0,1,2,3,4,5,6,7,8,9};printf("%d\n",func(a,10));return 0;}
有数组越界和调用错误,修改如下:include<stdio.h>int main(){void han(int a[10]);int b[10];int i;for(i=0;i<10;i++)scanf("%d",&b[i]);han(b);}void han(int a[10]){int i=1,count=0;for(i=1;i<=8;i++){if(a[i]>a[i-1]&&a[i]>a[i+1])count++;}print...
c=sum/n;return(c);} 方法很多,最直接的方法是,在函数中定义一个临时数组,然后2次循环,先将n往后的值存入新数组,再将n之前的值存入数组。最后把临时数组的值全部赋值给原数组。includevoid move(int arr[],int len,int n); 第1题:include#includedouble s1,s2,s3;void fun(double a,double b){s1=po...