
C++ Programs to Accompany Programming Logic and Design 8th Edition by Jo Ann Smith
Edition 8ISBN: 978-1285867410
C++ Programs to Accompany Programming Logic and Design 8th Edition by Jo Ann Smith
Edition 8ISBN: 978-1285867410 Exercise 1
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;}}
Which variable is the flag?
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;}}
Which variable is the flag?
Explanation
Refer code provided in Exercise 6-2 in t...
C++ Programs to Accompany Programming Logic and Design 8th Edition by Jo Ann Smith
Why don’t you like this exercise?
Other Minimum 8 character and maximum 255 character
Character 255