#include "lab8.h"

void main(void)
{
    int response;
    int count;
    string words[MAX_COUNT];
    
    /* your code goes here */
    

	while(1 > 0) 
     {
        response = showMenu();
       switch(response) 
        {
           case 0: return;
	           break;
            /* your code goes here */
        
        } /* end of switch */
    
    
     } /* end of while */


} /*end main */




int showMenu(void)
{
    int response;
    /*make this printf function complete to display the whole menu*/
    printf(" Main Menu\n"
	   " ---------\n"
	   " 1. Input words\n"
	   " 2. Display words\n"
	   " 3. Search for an exact match\n"
        " 4. Calculate the average length\n"
	   " 0. Exit\n");

    printf("\n Please enter a choice: ");
    /* use a scanf here to read users response from keyboard */

    return response;
}

int inputWords(string words[])
{

    FILE * ptr;

    /*declare and initialize the variable count*/
    int count = 0;

    ptr = fopen("shelterfromthestorm.txt","r");

  

	while( EOF != fscanf(ptr,"%s",words[count]))
       ++count;

  
	
    /* Remember to change this return statement below to actually return the value of count.*/
    /* Also don't forget to add a case 1:  in main. */
    return 0;
}




void displayWords(int count,string words[])
{
     int i;
    for(i=0; i < count ;++i)
        printf("%s\n", words[i]);
}




void exactMatch(int count, string words[])
{

    /*you code goes here*/

    /* Replace ... with appropriate variables and remove the comments later */
    /*   printf("The number of strings exactly matched with %s: %i\n", ...); */
}



void calculateMeanLength(int count, string words[])
{

    /*you code goes here*/

/* Replace ... with appropriate variables and remove the comments later */
/*    printf("The average length is %7.2lf letters per word.\n",...);*/
}