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

  • Thread starter Thread starter sunny86
  • Start date Start date
AI Thread Summary
The discussion revolves around creating a C program designed to analyze text files. The program should merge two specified text files and generate statistics, including the count of alphabetical letters, characters (with and without spaces), words, lines, and paragraphs. Users will interact with the program through a menu that offers two options: merging files or obtaining statistics from a merged file. When merging, users will input the names of the two files and the desired name for the merged output. For statistical analysis, the user will provide the name of the file to be analyzed. The output will detail counts for each statistical category, exemplified by a sample output showing the number of letters, characters, words, lines, and paragraphs in the analyzed file. The conversation also emphasizes the importance of users attempting the problem themselves rather than seeking direct code solutions.
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?
 
Thread 'Urgent: Physically repair - or bypass - power button on Asus laptop'
Asus Vivobook S14 flip. The power button is wrecked. Unable to turn it on AT ALL. We can get into how and why it got wrecked later, but suffice to say a kitchen knife was involved: These buttons do want to NOT come off, not like other lappies, where they can snap in and out. And they sure don't go back on. So, in the absence of a longer-term solution that might involve a replacement, is there any way I can activate the power button, like with a paperclip or wire or something? It looks...
I came across a video regarding the use of AI/ML to work through complex datasets to determine complicated protein structures. It is a promising and beneficial use of AI/ML. AlphaFold - The Most Useful Thing AI Has Ever Done https://www.ebi.ac.uk/training/online/courses/alphafold/an-introductory-guide-to-its-strengths-and-limitations/what-is-alphafold/ https://en.wikipedia.org/wiki/AlphaFold https://deepmind.google/about/ Edit/update: The AlphaFold article in Nature John Jumper...
Back
Top