⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sqinsert.cpp

📁 常用算法与数据结构原代码
💻 CPP
字号:
#include <iostream.h>
#define N 100

int Insert(int list[],int &count,int i,int x)
{
	int k;
	if (i<0 || i>count)
		return 1;
	if (count==N)
		return 2;
	for (k=count;k>i;k--)
		list[k]=list[k-1];
	list[i]=x;
	count++;
	return 0;
}

void main()
{
	int a[N]={1,2,3,4,5,6,7};
	int i,n=7;
	int flag;
	flag=Insert(a,n,4,8);
	cout<<flag<<endl;
	for (i=0;i<n;i++)
		cout<<a[i]<<"  ";
	cout<<endl;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -