Microsoft Word Assignment3F16doc Assignment3F16pdf Mozilla F

Microsoft Word Assignment3F16.doc Assignment3F16.pdf Mozilla Firefox put output 15 L... x O wizpert e Searc 16 pdl Automatic Zoom 1. Overview For this assignment, you will write a multi-file program that will perform some analysis on the contents ofa file (that is provided to you) by reading the contents into a 2-D array. The purpose of this assignment is to give you some experience performing some file vo: also more experience with multiple files, including header and makefiles, function calls that take in arguments and retum values, passing amaysasan argument: as well as the other C conce you have leamed thus far. pts from the in the of Each row ofthe array isone file. Once you have the contents stored in the array, you can perfom different tasks, such as printing the contents back out to the screen, counting the number of in the file count the number of words in the file, counting the number of characters ting number of in the file, converting the case of each character, and searching for a word specified by the user and showing the occurrences for that word. 2. More specifics Your program should contain the following files: 2. asg3.c. (contains main text Init text Print o functions) counts .c (contains the cou which will find the number of words and the number of characters) convert case c (contains convertcase function, like you did in lab 6) 5. wordsearch.c ns search Forword function. which has something tricky about it) 6. makefile Your makefile should name your executable ang3) defs.h will provide this file to you) 7. poe-raven .txt will provide this file to you) To copy the two files that I am providing plus a sample output.txt file, navigate to your working directory and type the following: cp /hone/chochri/111/F16/as g3/* we will not get through pointers carly enough, you can do the entire program without any pointers and torun the program, you should redirection by typing the following: as 93 You will see from the defs.h file provided to you, the following prototypes: int text Init (char allLines IMAX LINK MAX LINE LEN oid text PEint tchar all lin IMAX LINE MAX LINE LEN void eount int nunLines) int num Lines ar al 11, Line MAX LINE void search orleord (eha MAX LINE LEN all Lines tMAx LINE MAX LINE LEN int numLines) The find function, text init returns an int This is the function line fills up the array with the text fiom the file, line by by the end of the koop, the number oflincs is known. Retum dat up the array line by

Solution

#include<stdio.h>
#include<stdlib.h>
int main(int argc, char *argv[])
{
   FILE *file = fopen( argv[1], \"r\" );//opening file
   char txt[20000];
   char text[100][200];
   if ( file == 0 )
        {
            printf( \"Could not open file\ \" );
        }
   else
   {
      
       fgets(txt,200,file);//reading and storing in txt
       int i,j;
       for(i=0;i<100;i++)
       {
           for(j=0;j<200;j++)
           {
               text[i][j]=txt[i+j];//storing in 2d array
               printf(\"%c\",text[i][j]);  
           }
              
       }
  
   }  
   close(file);//closing file
   return 0;
}

 Microsoft Word Assignment3F16.doc Assignment3F16.pdf Mozilla Firefox put output 15 L... x O wizpert e Searc 16 pdl Automatic Zoom 1. Overview For this assignme

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site