Respuesta :
Answer:
Program
#include <iostream>
#include <string>
using namespace std;
int main()
{
 // Declare variables
 string inCity;  // name of city to look up in array
 const int NUM_CITIES = 10;
 // Initialized array of cities
 string citiesInMichigan[] = {"Acme", "Albion", "Detroit", "Watervliet", "Coloma", "Saginaw", "Richland", "Glenn", "Midland", "Brooklyn"};
 bool foundIt = false; // Flag variable
 int x;     // Loop control variable
 // Get user input
 cout << "Enter name of city: ";
 cin >> inCity;
 //cout<<citiesInMichigan.length<<endl;
 // Write your loop here
 for (string ch: citiesInMichigan)
 {
  // Write your test statement here to see if there is
  // a match. Set the flag to true if a city is found.
 if(ch==inCity)
 {
   foundIt=true;
   break;
 }
 }
 // Test to see if the city was not found to determine if
 // "Not a city in Michigan" message should be printed.
 if(foundIt==false)
  cout<<"Not a city in Michigan"<<endl;
 else
 cout<<inCity<<" is a city in Michigan"<<endl;
 return 0;
} // End of main() please help me
Sample Outputs
Enter name of city: Glenn
Glenn is a city in Michigan
Enter name of city: Delhi
Not a city in Michigan
Enter name of city: Brooklyn
Brooklyn is a city in Michigan
Enter name of city: Cochin
Not a city in Michigan
Explanation: