读书人

急解决方案

发布时间: 2012-03-20 14:01:11 作者: rapoo

急~~~~~~~
Write a function that returns the difference between the largest and smallest elements in an array of double. Test the function in a program.


谢谢~~~~~~急~~~~~~~~~~~~

[解决办法]
搞定,还真的要动点脑筋---呵呵!

C/C++ code
#include<stdio.h>#define LEN 5    /*数组长度*/ void dprea(int array[][], int arr_len){      int i;      for(i=0;i<arr_len;i++)          *((*array+2*arr_len)+i)=*(*array+i)+*((*array+arr_len)+i);  }  int main(){      int temp;      int arr[3][LEN];   /* 三个数组一起定义 */      printf("Please input int values for the first array's members!\n");      for(temp=0;temp<LEN;temp++)          scanf("%d",arr[0]+temp);      printf("Please input int values for the second array's members!\n");      for(temp=0;temp<LEN;temp++)          scanf("%d",arr[1]+temp);      dprea(arr,LEN);            printf("The third array's mumber is :\n");      for(temp=0;temp<LEN;temp++)            printf("arr[%d]=%d\n",temp,arr[2][temp]); //输出第三个数组的每个元素      system("pause");      return 0;} 

读书人网 >C语言

热点推荐