一.数组的合并
#include <iostream>
using namespace std;
int main()
{
const int n=10;
int a[5]={1,6,7,9,10},b[5]={2,4,8,12,14},c[10],t,j,k;
for(t=0;t<5;t++)
c[t]=a[t];
for(int i=0;i<5;i++)
c[t++]=b[i];
for(k=0;k<n-1;k++)
for(t=0;t<n-k-1;t++)
{
if(c[t]>c[t+1])
{
j=c[t];
c[t]=c[t+1];
c[t+1]=j;
}
}
for(t=0;t<10;t++)
cout<<c[t]<<" ";
cout<<endl;
return 0;
}
二.字符串的删除
#include <iostream>
using namespace std;
int main ()
{
char s[20],a;
int i=0,j;
cout<<"请输入字符串s:";
cin.getline(s,20);
cout<<"请输入删除的字符a:";
cin>>a;
while(s[i]!='\0')
{
j=1;
if(*(s+i)==a)
j=0;
if(j!=0)
{
cout<<*(s+i);
}
i++;
}
cout<<endl;
return 0;
}