Skip to content

Repository files navigation

ChemCalC++

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.

Features

  • 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.

How to Compile and Run

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):

  1. Save Files: Ensure ATOMICMA.H and PCOPY.CPP are in the same directory.

  2. Compile: Open your C++ IDE (e.g., Turbo C++ IDE) or command prompt and compile PCOPY.CPP. You might need to link ATOMICMA.H during compilation, though typically, #include directives 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.h with iostream and conio.h with alternatives or removing clrscr/getch for cross-platform compatibility):

    g++ PCOPY.CPP -o ChemCalC++
  3. Run: Execute the compiled program.

    ./ChemCalC++

    (Or ChemCalC++.exe on Windows)

Usage

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.

File Structure

  • ATOMICMA.H: Header file containing the Element structure, 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 the Molecule, MolarMassCalculator, SolutionMaker, and DilutionCalculator classes, and contains the main function that drives the user interface and program flow.
  • PROJECTM.CPP: (Likely an older or alternative version) This file contains similar functionalities to PCOPY.CPP but with a simpler main function and potentially minor differences in implementation details. PCOPY.CPP is recommended for use.
  • ChemCalC++_Miniproject.docx, 128 ChemCalC++_Miniproject.docx: Project documentation/reports.
  • ChemCalC++.pptx, ~$ChemCalC++.pptx: Project presentation files.

Contributing

Feel free to fork this repository, make improvements, and submit pull requests.

License

This project is open-source and available under the MIT License.

About

ChemCalC++ is a CLI chemistry calculator built in Turbo C++. It helps students and educators perform key chemical calculations like molar mass, solution prep, and dilution formulas—ideal for quick, text-based problem solving in labs or classrooms.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages