ChemCalC++ is a command-line interface (CLI) application developed in C++ (originally for Turbo C++) that provides essential chemical calculations. It's designed to assist students and professionals with common chemistry problems, including molar mass determination, solute mass calculation for solution preparation, and dilution calculations.
- Molar Mass Calculator: Calculates the molar mass of a chemical compound given its formula (e.g., H2O, CO2, Ca(NO3)2). It intelligently handles parentheses and subscripts.
- Solute Mass Calculator: Determines the mass of solute required to prepare a solution of a specific molarity and volume. Users can either input the molar mass directly or have it calculated from the chemical formula.
- Dilution Calculator (M1V1 = M2V2): Solves for an unknown variable in dilution problems (initial concentration, initial volume, final concentration, or final volume) given the other three.
This project was originally developed for Turbo C++. To compile and run it, you will typically need a compatible C++ compiler environment, such as Turbo C++ or a modern compiler configured to support older C++ standards and libraries (like conio.h).
Prerequisites:
- A C++ compiler (e.g., Turbo C++, Borland C++, or a modern compiler like g++ with appropriate flags for compatibility).
Steps to Compile (Example using a compatible compiler):
-
Save Files: Ensure
ATOMICMA.HandPCOPY.CPPare in the same directory. -
Compile: Open your C++ IDE (e.g., Turbo C++ IDE) or command prompt and compile
PCOPY.CPP. You might need to linkATOMICMA.Hduring compilation, though typically,#includedirectives handle this automatically.If using a command-line compiler like g++ (and if you've adapted the code for modern compilers, e.g., by replacing
iostream.hwithiostreamandconio.hwith alternatives or removingclrscr/getchfor cross-platform compatibility):g++ PCOPY.CPP -o ChemCalC++
-
Run: Execute the compiled program.
./ChemCalC++
(Or
ChemCalC++.exeon Windows)
Upon running the program, you will be presented with a menu:
============================== ChemCalC++ ==============================
Please select an option:
1. Calculate Molar Mass of a Compound
2. Calculate Mass of Solute for Solution Preparation
3. Calculate Dilution (M1V1 = M2V2)
Enter your choice (1, 2, or 3):
Follow the on-screen prompts to perform your desired calculation. The program will ask if you want to perform another calculation after each operation.
ATOMICMA.H: Header file containing theElementstructure, a global array of chemical elements with their symbols and atomic masses, and the total count of elements. This file serves as the data source for atomic weights.PCOPY.CPP: The main source code file for the ChemCalC++ application. It implements theMolecule,MolarMassCalculator,SolutionMaker, andDilutionCalculatorclasses, and contains themainfunction that drives the user interface and program flow.PROJECTM.CPP: (Likely an older or alternative version) This file contains similar functionalities toPCOPY.CPPbut with a simplermainfunction and potentially minor differences in implementation details.PCOPY.CPPis recommended for use.ChemCalC++_Miniproject.docx,128 ChemCalC++_Miniproject.docx: Project documentation/reports.ChemCalC++.pptx,~$ChemCalC++.pptx: Project presentation files.
Feel free to fork this repository, make improvements, and submit pull requests.
This project is open-source and available under the MIT License.