#include <iostream>
using namespace std;
int main(int argc, char** argv)
{
int data[5] = { 1,2,3,4,5 };
int count = 0;
bool h = false;
int search = 5;
while (count < 5)
{
if (data[count] == search)
{
cout << "Have data at position " << count+1 << endl;
h = true;
break;
}
count++;
}
if (h == false)
cout << "Have not data in array" << endl;
return 0;
}
ไม่มีความคิดเห็น:
แสดงความคิดเห็น