项目一:数组合并
<span style="font-size:14px;">#include <iostream>
using namespace std;
int main()
{
int a[5]= {1,4,8,18,22},b[5]= {8,7,65,89,2},c[10],i,j,t,n;
cout<<"把已知的两个数组进行合并。"<<"\n";
for(i=0; i<5; i++)
{
c[i]=a[i];
c[i+5]=b[i];
}
for(i=0; i<9; i++)
for(j=0; j<9-i; j++)
{
if(c[j]>c[j+1])
{
t=c[j];
c[j]=c[j+1];
c[j+1]=t;
}
}
cout<<"合并后的数组是:"<<"\n";
for(i=0; i<10; i++)
cout<<c[i]<<" ";
cout<<endl;
return 0;
}</span>