Lab Assignment for Switch Statements

  1. Write programs using looping and switch statements to count all the punctuation marks in a file. A shell program is given below as a staring point.
    //Count punctuation marks in a file.
    using namespace std;
    int main ()
      ifstream  inData;
      char symbol;
      int  periodCt = 0;			//The total number of periods (.)
      int  commaCt = 0;			//The total number of commas (,)
      int  questionCt = 0;			//The total number of question marks (?)
      int  colonCt = 0;			//The total number of colons (:)
      int  semicolonCt = 0;			//The total number of semi-colons (;)
      /* FILL IN HERE */
      //Use a loop to read the input data file symbol by symbol
      //As reading goes, check which type of punctuation the symbol belongs to 
      //and increment the corresponding counter.
      //Once finishing with reading, print out the total counts of the punctuation marks.
      return 0;
    Symbols in the file "switch.txt" are:
    There are lots of symbols in this file:  ..;;??.,.,.,
    ?:::  .
  2. By the end of class, turn in printouts of your program and output. Make sure to write your name on the printouts.