In the below FOR Loop, I only want VALUE FOUND or VALUE NOT FOUND
printed once. Right now depending on what array[index] the value is in
(ie. if it's in the third index) it will print VALUE NOT FOUND twice, then
VALUE FOUND.
How do I modify to print either statement 1x? Partial Code follows...
-----------------------------------------------------------------------------------------------------
cin >> choice;
for (int count = 0; count < 5; count++)
{
if (numbers[count] == choice)
cout << "VALUE FOUND: " << choice << endl;
else
cout << "VALUE NOT FOUND:" << endl;
}
-----------------------------------------------------------------------------------------------------
Thanks for any assistance. I'm a beginner by the way.
-JY