How Can I Create a Text File Analyser in C Program?

  • Thread starter Thread starter sunny86
  • Start date Start date
Click For Summary
SUMMARY

The discussion focuses on creating a text file analyser using the C programming language. The program must merge two text files and provide statistics on alphabetical letters, characters (with and without spaces), words, lines, and paragraphs. Users interact with a menu to choose between merging files or analyzing a specified text file. The example output demonstrates the expected statistics format after analysis.

PREREQUISITES
  • Proficiency in C programming language
  • Understanding of file handling in C
  • Knowledge of string manipulation techniques
  • Familiarity with basic data structures for storing statistics
NEXT STEPS
  • Implement file merging in C using standard I/O functions
  • Learn about C string functions for counting characters and words
  • Explore dynamic memory allocation for handling variable-sized text data
  • Research algorithms for parsing text files and counting statistics
USEFUL FOR

C programmers, software developers, and students looking to enhance their skills in file handling and text processing in C.

sunny86
Messages
10
Reaction score
0
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:
Menu
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:

filename3.txt
Alphabetical letters 100
Characters (without spaces) 120
Characters (with spaces) 200
Words 30
Lines of text 5
Paragraphs 2
 
Computer science news on Phys.org
Do you expect us to flat out give you the code? Where is your attempt at the problem?
 

Similar threads

  • · Replies 2 ·
Replies
2
Views
2K
Replies
1
Views
3K
  • · Replies 7 ·
Replies
7
Views
2K
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 6 ·
Replies
6
Views
4K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 3 ·
Replies
3
Views
4K
Replies
1
Views
2K
  • · Replies 5 ·
Replies
5
Views
4K
  • · Replies 3 ·
Replies
3
Views
3K