C++ command-line utilities

Programming project · C++, vectors, algorithms, hash maps

I built a menu-driven C++ program with arithmetic, statistics, text encryption and decryption exercises, and password generation options. The features are separated into implementation and header files, and the main menu loops until the user selects the exit option.

Implementation

Statistics

The statistics routines accept a std::vector<double>. It calculates the mean from a running sum, finds the median by sorting a copy of the inputs, and counts values in an std::unordered_map to determine a mode. For an even number of inputs, the median is the average of the two middle values.

Input handling

I added checks for menu selections, statistical inputs, and division by zero. Invalid menu input clears the stream state and discards the remaining line. The statistics input routine requires a positive count before reading values.

Program structure

The main program handles menu navigation and calls the individual utility modules. Arithmetic options include addition, subtraction, multiplication, division, and exponentiation.

Source files

Related C++ training

View C++ Programming Fundamentals certificate