64,654
社区成员
发帖
与我相关
我的任务
分享
#include <iostream>
#include <cstdlib>
using namespace std;
int main()
{
int a[16] = {-12,3,-12,4,1,1,-12,1,-1,1,2,3,4,2,3,-12};
int i,k,index[5], m;
int j=0;
char c = 'Y';
for(i=0;i <16;i++)
cout << a[i] << "\n";
cout <<"input what do you want to find:" <<endl;
k = 0;
while (c == 'Y' || c == 'y')
{
cout << "input:";
cin >> index[k++];
cout << "is there more? (Y/N)" << endl;
cin >> c;
}
for(m=0;m <k;m++)
{
j = 0;
for(i=0;i <16;i++)
if(index[m]==a[i])
++j;
cout << index[m] << " : " << j << endl;
}
return 0;
}