找出10个被打乱的数中被拿出的一个数

#include <iostream>
using namespace std;

int main()
{
int a[9]={2,8,1,7,5,6,9,3,0};
int b[10];
int i;
for (i=0;i<10;i++)
{
b[i]=-1;
}

for (i=0;i<9;i++)
{
b[a[i]]=a[i];
}

for (i=0;i<10;i++)
{
if (b[i]==-1)
{
cout<<i<<endl;
break;
}
}

system("pause");
return 0;
}
原文地址:https://www.cnblogs.com/tiandsp/p/2336932.html