Project3 | ||
Project3.sln | ||
README.md |
Frequency Calculator
This is a simple frequency calculator that can be used to calculate the frequency of a given word in a given text. It is written in C++. Originally created as a grocery analyzer, this calculator was created using Visual Studio 2019 Community Edition.
The program works by taking in a text file where each line is a unique, one-word string. These strings are counted and output into a file called frequency.dat. Afterwards, the program allows you to visualize the data in two ways: first, simply the string with the frequency; second, a histogram of stars.
Some ease-of-life functions include allowing the user to input the name of a file to use if the default file is not found, and color coding to separate user input and important output from standard output.
In this program, some things I did particularly well were documenting the different sections of code. I kept the comments short enough to not be distracting, and if you follow the comment lines, one could easily read through the story of the program. I did a good job at keeping the code readable and maintainable, and I think that the code is very adaptable to other projects with additional features which are unused in the example.
Areas of improvement to the code could be to add more features, such as the ability to sort the data in different ways, or to add a feature to allow the user to input a string to search for.
To ensure the code is secure, I used the a standard C++ library to handle all of the string manipulation. I also used a standard C++ library to handle all of the file manipulation.
The most challenging part of the code was writing the histogram function. It was important to me that it look friendly so I write a nice style that keeps it organized and easy to read. Although challenging, I am hapy with the result. I overcame the challenges by reverting back to my notes about length of strings and how to space everything out. Lastly, adding color to the input was important so that the user was not lost in a wall of text. I had to look up the console colors. I learned a few new things with this program so I will take those lessons on with me throughout my career.
File manipulation is a very important skill to have in the field of computer science. I will be able to use this skill in many different projects in the future. I currently work on reports and do them by hand but I can automate them since most of it is copy/pasting work. File manipulation learned here helps me process the data more efficiently.
The code is readable and maintainable because I used standard layout and naming conventions. I used comments to explain what each section of code does. I tried to keep the amount of code as small as possible to uncomplicate it.
- Cody Cook
- Southern New Hampshire University
- CS-210-T4133 Programming Languages 23EW4