expand icon
book C++ Programs to Accompany Programming Logic and Design 8th Edition by Jo Ann Smith cover

C++ Programs to Accompany Programming Logic and Design 8th Edition by Jo Ann Smith

Edition 8ISBN: 978-1285867410
book C++ Programs to Accompany Programming Logic and Design 8th Edition by Jo Ann Smith cover

C++ Programs to Accompany Programming Logic and Design 8th Edition by Jo Ann Smith

Edition 8ISBN: 978-1285867410
Exercise 12
Searching an Array for an Exact Match
In this exercise you use what you have learned about searching an array for an exact match. Study the following code, and then answer Questions. Note that this code may contain errors.
string apples[] = {"Gala", "Rome", "Fuji", "Delicious"};int foundIt = false, i;const int MAX_APPLES = 4;string inApple;cout ? "Enter apple type:";cin ? inApple;for(i = 0; i = MAX_APPLES; i++){if(inApple == apples[i]){foundIt = true;}}
Is the for loop written correctly? If not, how can you fix it
Explanation
Verified
like image
like image

Searching an array:
Refer code provided...

close menu
C++ Programs to Accompany Programming Logic and Design 8th Edition by Jo Ann Smith
cross icon