1. Target
- Using development tools (Eclipse or Visual Studio)
- Developing languages (c, C + +, C #, or Java)
- Using Source control tools (Github)
2. Requirements
(1). Implement a console program, given an English string, to count the occurrences of each English word (4 characters above with 4 characters).
- Output requirements: Output words and frequencies in descending order of frequency, and the same frequency is output in alphabetical order. As shown below:
file: 3word: 2case: 1considered: 1insensitive: 1same: 1
- Additional requirements: read a text file to count the frequency of the words in the text file, and the above requires the output of statistical results.
(2). Performance Analysis:
- Run VS's performance analysis tool for C + + code to identify performance issues and optimize them.
- Run the profiling tool on the Java program NetBeans IDE 6.0 to identify performance issues and optimize them.
3. Submissions include:
(1). GitHub: Code check-in to GitHub
- Ensure the results are correct
- Don't have a warning.
- Good performance
- Ensure that the unit test code passes
(2). Blog: Submit Blog
- At the beginning of the project, you estimate how long each function module will take
- After the project is completed, you actually spend the time in each function module
- Describe how much time you spent on improving program performance, using VS performance analysis tools to showcase your performance graphs
- Show your unit test results and explain how you ensure that the unit test results are correct
- What did you learn in this exercise?
- Write on the blog "where is the most proud and unique design of your program?" What did you think of that? Where is the biggest bug? Please post some code and explain "(Zx_proposal)
4. Job Tips (1). Defined
- Letter : A-Z, A-Z.
- alphanumeric : A-Z, A-Z, 0-9.
- delimiter : non- alphanumeric
- Word :
- Contains 4 or more than 4 characters
- words separated by delimiters
- If a string contains _ non _ alphanumeric , it is not a word
- Word -case insensitivity, such as "file", "File", and "file" can be considered the same word
- The word must start with a letter , "file123" is a word, "123file" is not a word
(2). Example
Input
case insensitive, i.e. “file”, “FILE” and “File” are considered the same word.
Output
file: 3word: 2case: 1considered: 1insensitive: 1same: 1
(3). Reference Resources
5. Code
#include <iostream> using Std::cout; Using Std::endl;
Function: Find the number of times a substring sub appears in Str
int fun (const std::string& STR, Const std::string& sub)
{
int num = 0;
for (size_t i=0; (I=str.find (sub,i))! = Std::string::npos; num++, i++);
return num;
}
void Main ()
{
std::string Str ("Many of my classmates has a computer, I have one too. My father bought it for me as a present when my first year in middle school. He said I can study 中文版 with computer. Most of the time, I use computer to search study materials on the Internet. I also has some foreign friends on the internet and we can talk in 中文版. Sometimes I play video game with computer after I finish my homework. My computer helps me a lot, it's a good friend to me. ");
std::string Sub ("Computer");
Cout<<fun (str,sub) <<endl;
}
6. Results
7. Summary
I first wanted to use KMP match to do, and then did not debug, and the counter also added not to give up, and finally used this stupid way <<**@**>>
Third time job