Analyzing Census data:  Town Count

Write a program that reads in the Maryland data file


and prints out the number of towns.  Note:  You'll
have to save the data file to your machine first!
#include <iostream>
#include <fstream>
#include <string>

using namespace std;

int main()
  // Open input file
  ifstream fin("24md.txt");

  // Initialize town count
  int count_t;
  count_t = 0;

  // Read in string until file is finished
  string s;
  while(fin >> s)
    if (s == "town")

  // Write results
  cout << "There are " << count_t
       << " towns in Maryland" << endl;
  return 0;