Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

How to do this problem ?

  1. Sep 6, 2005 #1
    How to do this problem ??

    Write a complete C program that can be used as a text file analyser. The analyser program should be able to combine two text files and provide the statistics of the following items in a text file: number of alphabetical letters (A to Z and a to z), characters (without spaces), characters (with spaces), words, lines of text, and paragraphs. The text files (e.g. filename.txt, filename.c or filename.dat created using MS DOS Editor or MS Notepad) should contain English words, and each paragraph is separated by a blank line.

    When the program is run, the user is prompted to select an option from a menu as shown below:
    1. Merging two text files
    2. Obtain the statistics of a text file

    If option 1 is selected, then the following prompts appear:

    Enter the names of the two files to be merged: filename1.txt filename2.txt
    Enter the name of the merged file: filename3.txt

    If option 2 is selected, then the following prompt appears:

    Enter the name of the file to be analysed: filename3.txt

    An example output of the option 2 is as below:

    Alphabetical letters 100
    Characters (without spaces) 120
    Characters (with spaces) 200
    Words 30
    Lines of text 5
    Paragraphs 2
  2. jcsd
  3. Sep 6, 2005 #2


    User Avatar
    Staff Emeritus

    Do you expect us to flat out give you the code? Where is your attempt at the problem?
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook