# 第二次作业 **Repository Path**: interneuron/second-assignment ## Basic Information - **Project Name**: 第二次作业 - **Description**: No description available - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2025-10-30 - **Last Updated**: 2025-10-31 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # **文本计数统计工具** **项目简介** 这是一个基于C++开发的命令行文本计数统计程序,能够快速统计纯英文文本文件中的字符数、单词数和句子数。程序采用面向对象设计,具有清晰的代码结构和良好的错误处理机制。 **a.功能特性** 字符统计:精确统计文件中的总字符数(包括空格、标点等) 单词统计:智能识别并统计英文单词数量 句子统计:基于标点符号准确统计句子数量 多种输出模式:支持单独统计和全部统计 健壮性:完善的错误处理和用户提示 **b.文件列表及说明** | 文件 | 版本 | 类型 | 说明 | |------------|------|------|------| | `v0.1` | v0.1 | 版本标记文件 | 空项目初始化版本标记 | | `wc.exe` | v0.2 | 可执行文件 | 编译后的文本计数统计程序 | | `main.cpp` | v0.2 | 源代码文件 | 主程序源代码,包含字符、单词、句子统计功能 | | `wc2.0.exe` | v0.3 | 可执行文件 | 增强版本文本计数统计程序(含扩展功能) | | `main2.0.cpp` | v0.3 | 源代码文件 | 增强版本主程序源代码(含扩展功能和性能分析) | | `test.txt` | v0.2 | 测试文件 | 综合测试用例文件 | | `test.cpp` | v0.2 | 源代码文件 | 单元测试程序 | | `test.exe` | v0.2 | 可执行文件 | 单元测试程序编译结果 | | `test2.0.cpp` | v0.3 | 源代码文件 | 增强版本单元测试程序 | | `test2.0.exe` | v0.3 | 可执行文件 | 增强版本单元测试程序编译结果 | 文件详细说明 **c.使用方法** ***环境要求*** · C++编译器(GCC/MinGW) · Windows/Linux/macOS命令行环境 ***编译程序*** ```bash # 使用g++编译 g++ -o wc.exe main.cpp ``` ***命令格式*** ```bash wc.exe [参数] [文件名] ``` ***参数说明*** -c : 统计字符数 -w : 统计单词数 -s : 统计句子数 -a : 显示所有统计信息 **d.例程运行及结果** ***测试文件内容 (test.txt)*** ``` The Art of Programming Chapter 1: Introduction to Computer Science Computer programming is the process of designing and building an executable computer program to accomplish a specific computing result. Programming involves tasks such as analysis, generating algorithms, profiling algorithms' accuracy and resource consumption, and the implementation of algorithms in a chosen programming language. The source code of a program is written in one or more languages that are intelligible to programmers, rather than machine code, which is directly executed by the central processing unit. The purpose of programming is to find a sequence of instructions that will automate the performance of a task on a computer, often for solving a given problem. Why Learn Programming? Programming enables people to solve practical problems by breaking them down into a sequence of computational steps. Some examples of programming applications include: 1. Web development - creating websites and web applications 2. Mobile app development - building applications for smartphones and tablets 3. Data analysis - processing and analyzing large datasets 4. Artificial intelligence - developing intelligent systems and machine learning models 5. Game development - creating video games and interactive entertainment 6. System programming - developing operating systems and low-level software Programming languages come in different paradigms, each with its own strengths and weaknesses. Some popular programming languages include: - Python: Known for its simplicity and readability, widely used in data science and web development. - Java: A versatile language used in enterprise applications and Android development. - C++: A powerful language for system programming, game development, and performance-critical applications. - JavaScript: The language of the web, essential for front-end and back-end web development. - C#: Developed by Microsoft, commonly used for Windows applications and game development with Unity. The Fundamentals of Programming Regardless of the language chosen ``` ***运行示例*** ![输入图片说明](0E963D8FDE73963C90667AC1152692A0.png) ***错误处理示例*** ![输入图片说明](QQ_1761837824652.png)