文件名称:ex
介绍说明--下载内容均来自于网络,请自行研究使用
(1)一个包含10个元素的数组,已按升序排序,输入一个任意的整数,将该整数插入数组中,使数组元素仍保持升序排列。
要求编写一个通用的插入排序函数InsertSort,它带有三个参数,第一个参数是含有n个元素的数组,这n个元素已按升序排序;第二个参数给出当前数组中元素的个数;第三个参数是要插入的整数。该函数的功能是将一个整数插入到数组中,然后进行排序。另外还需要一个用于输出数组元素的函数Print,要求每一行输出5个元素。
(2)编程求下列两个矩阵的加法(结果矩阵的元素值是这两个矩阵相应元素之和)。要求:定义函数MatAdd用于求矩阵的加法,函数Show用于输出矩阵。
(3)要求设计一个函数void strcpy(char a[],char b[]),将b中的字符串复制到数组a中(要求不使用C++的库函数strcpy())。编写完整的程序并测试。-(1) contains an array of 10 elements have been sorted in ascending order, enter an arbitrary integer, the integer array is inserted so that the array elements remain in ascending order. Requested to prepare a common insertion sort function InsertSort, it takes three parameters, the first parameter contains an array of n elements, which has n elements sorted in ascending order second parameter gives the current number of elements in the array The third parameter is an integer to be inserted. A function that is inserted into an integer array and then sorted. You also need a function to Print output of array elements, requires that each line of output five elements. (2) for adding the following two programming matrix (matrix element of the result is that the value of the corresponding element of the matrix and two). Requirements: Defined Functions MatAdd for Matrix addition, the function Show for output matrix. (3) requires the design of a function void strcpy (char a [], char b []), c
要求编写一个通用的插入排序函数InsertSort,它带有三个参数,第一个参数是含有n个元素的数组,这n个元素已按升序排序;第二个参数给出当前数组中元素的个数;第三个参数是要插入的整数。该函数的功能是将一个整数插入到数组中,然后进行排序。另外还需要一个用于输出数组元素的函数Print,要求每一行输出5个元素。
(2)编程求下列两个矩阵的加法(结果矩阵的元素值是这两个矩阵相应元素之和)。要求:定义函数MatAdd用于求矩阵的加法,函数Show用于输出矩阵。
(3)要求设计一个函数void strcpy(char a[],char b[]),将b中的字符串复制到数组a中(要求不使用C++的库函数strcpy())。编写完整的程序并测试。-(1) contains an array of 10 elements have been sorted in ascending order, enter an arbitrary integer, the integer array is inserted so that the array elements remain in ascending order. Requested to prepare a common insertion sort function InsertSort, it takes three parameters, the first parameter contains an array of n elements, which has n elements sorted in ascending order second parameter gives the current number of elements in the array The third parameter is an integer to be inserted. A function that is inserted into an integer array and then sorted. You also need a function to Print output of array elements, requires that each line of output five elements. (2) for adding the following two programming matrix (matrix element of the result is that the value of the corresponding element of the matrix and two). Requirements: Defined Functions MatAdd for Matrix addition, the function Show for output matrix. (3) requires the design of a function void strcpy (char a [], char b []), c
(系统自动生成,下载前可以参看下载内容)
下载文件列表
ex-5-1.cpp
ex-5-2.cpp
ex-5-3.cpp