1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
|
#include <iostream>
using namespace std;
int main()
{
int search;
int array[20] = {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20};
cout<<"Please enter a number for me to search in the array." << endl;
cin >> search;
cout << "Enter your twenty numbers" << endl;
for (int i = 0; i <= 19; i++)
{
if (search = array[i])
cout << search << "is in your array" << endl;
else if (search /= array[i])
cout << search << "is in your array" << endl;
}
system ("pause");
}
|