有关c语言的
Text Processing
Write a program that reads a text file that contains some texts. The program should count the number of lines, number of words, number of characters (no spaces), number of characters with spaces and the number of paragraphs. This program should be similar to the word count function in Microsoft Word. These results should be written to another file.
A sample run of the program should look like this:
Please enter the file name: words.txt
Processing….
The results can be found at words.rpt
If the file “words.txt” contains:
In artificial intelligence ,an embodied agent is an intelligent agent , that interacts with the environment through a physical body within that environment. Agents that are represented graphically with a body, for example a human or a cartoon animal, are also called embodied agents, although they have only virtual, not physical, embodiment. A branch of artificial intelligence focuses on empowering such agents to interact autonomously with human beings , and the environment.
Mobile robots , are one example of physically embodied agents; Ananova , and Microsoft Agent ,are examples of graphically embodied agents. Embodied Conversational agents are embodied agents (usually with a graphical front-end as opposed to a robotic body) that are capable of engaging in conversation with one another and with humans employing the same verbal and nonverbal means that humans do (such as gesture, facial expression, and so forth).
Then file “words.rpt” should contain:
Number of words: 137
Number of characters not including space: 780
Number of characters including spaces: 916
Number of paragraphs: 2
Number of lines: 12
|