#include#include#include#includeint n=10;void sort(int r[],int n);//冒泡排序void insert1(int arr[],int n,int element,int n0);//插入1:在指定位置插入,n0是插入的位置void insert2(int arr[],int element,int n);//插入2:在有序数列中插入void reverse(int arr[],int a,int b);//逆置数组,从a到bvoid zuoxuan(int arr[],int n,int k);//左旋数组void youxuan(int arr[],int n,int k);//右旋数组void output(int arr[],int n);//打印数组void jiaohuanpaixu(int arr[],int n);//交换排序void delect1(int arr[],int n,int n0);//删除指定下标的元素void delect2(int arr[],int n,int n0);//删除指定值void delect3(int arr[],int a,int b,int n);//删除指定下标区间的元素int judge1(int arr[],int n);//判断是否是升序,并输出是否升序,其中变量n是记录数组的长度int judge2(int arr[],int n);//判断是否是降序排列void judge3(int arr[],int n);//判断数组元素是否都相等double aver(int arr[],int n);//求平均数,返回平均数int Max(int arr[],int n);//求最大值int Min(int arr[],int n);//求最小值double fangcha(int arr[],int n);//求方差void xuanze_paixu(int arr[],int n);//选择排序void putongchazhao(int arr[],int n,int n0);//普通查找void erfenchazhao(int arr[],int k,int n);//二分查找void josephus(int die[],int n,int m,int s);//约瑟夫环void goldbach(int n);//验证哥德巴赫猜想void shujutianchong1(int arr[],int n,int a);//用小于a的随机数填充数组void shujutianchong2(int arr[],int n);//从键盘输入void shujutianchong3(int arr[],int n,int n0);//整个数组填同一个值void shujutianchong4(int arr[],int a,int b,int n);//等差数列填充数组double junfangcha(int arr[],int n);//求均方差
void sort(int r[],int n){int i,j,lastExchangeIndex;int temp;i=n;while(i>0){lastExchangeIndex=0;for(j=1;jr[j]){temp=r[j];r[j]=r[j-1];r[j-1]=temp;lastExchangeIndex=j;}}i=lastExchangeIndex;}}
void insert1(int arr[],int n,int element,int n0)//n是长度,n0是插入下标{int i=0;for(i=n;i>n0;i--)arr[i]=arr[i-1];arr[n0]=element;}
void insert2(int arr[],int element,int n)//n是数组的长度,因为有插入函数,所以数组长度定义时候要大些{int i,j;for(i=0;ii+1;j--)arr[j]=arr[j-1];arr[i+1]=element;break;