2017.12.07

所属分类:源码/资料
开发工具:C/C++
文件大小:1KB
下载次数:28
上传日期:2018-11-28 19:00:00
上 传 者不能为空—
说明:  编写相应的程序用指针实现:从键盘输入3个整型数va、vb、vc,通过一个指向整型的指针iptr,输出3个数中的最大值。、 编写一个函数get_average()获取整型数组元素的平均值。要求这个函数既可以用来求一维数组元素的平均值,也可以求二维数组元素的平均值。 在main()函数中通过具体的一维数组Array_1D和二维数组Array_2D测试这个函数。假定一维数组为a[5],二维数组为b[2][3], 一维数组和二维数组的变量值由键盘分别输入,在屏幕上输出一维数组和二维数组的平均值,平均值间用一个空格分开。 将两个数组a和b合并,合并后的数组按升序输出。说明:1)数组a和b的大小和元素的值从键盘输入;先输入数组大小,再输入数组的值; 2)合并后的数组输出时,各数值间以空格分开。 输入 动态申请一个一维整型数组,要求用户从键盘输入元素个数,采用new运算符分配空间,从键盘输入数组变量的值. 写一个函数void Func(int* A, int nSize),使A把0移至后面,非0整数移至数组前面并保持有序(升序)。 将排序后的数组变量的值输出到屏幕上,各数值间用一个空格隔开。 输入 10 1 2 3 4 5 0 7 8 0 10 输出 1 2 3 4 5 7 8 10 0 0
(The corresponding program is implemented by pointers: three integer numbers va, VB and VC are input from the keyboard, and the maximum of three integer numbers is output through a pointer IPTR pointing to the integer. , Write a function get_average() to get the average value of an integer array element. It is required that this function can be used to calculate the average value of elements in one-dimensional array and two-dimensional array. In the main () function, the function is tested by a specific one-dimensional array Array_1D and a two-dimensional array Array_2D. Assuming that the one-dimensional array is a [5], and the two-dimensional array is B [2] [3], The variable values of one-dimensional and two-dimensional arrays are input by keyboard, and the average values of one-dimensional and two-dimensional arrays are output on the screen. The average values are separated by a space.)

文件列表:
2017.12.07.cpp (2469, 2017-12-07)

近期下载者

相关文件


收藏者