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 2
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 flag variable declared correctly? If not, what should you do to fix it?
Explanation
Verified
like image
like image

Refer code provided in Exercise 6-2 in t...

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