Welcome to the Harmonic Sum Calculator project! This repository showcases a hybrid programming approach that combines x86 assembly, C, and C++ to create an efficient harmonic sum calculator. The project was developed as part of CPSC 240 Assembly course and demonstrates the integration of different languages to achieve a functional and educational program. The calculator allows the user to input integer N to calculate the harmonic sum to the Nth precision.
The Harmonic Sum is the total sum of the Harmonic Series.
In this project, we use a hybrid approach to leverage the strengths of assembly, C, and C++ programming languages:
-
Assembly (
harmonic.asm): The assembly code performs efficient calculations for the harmonic sum. It provides the core computation logic for the calculator. -
C (
statistics.c): The C driver program coordinates the overall functionality of the calculator. It handles user input/output, interacts with assembly and C++ components, and ensures the smooth operation of the calculator. -
C++ (
isfloat.cppandreciprocal_sum.cpp): The C++ code assists in facilitating input validation (checking for floating-point numbers) and computing the reciprocal sum.
To run the Harmonic Sum Calculator:
-
Ensure you have the necessary toolchains installed (NASM, GCC, and G++).
-
Open your terminal or command prompt.
-
Navigate to the project directory.
-
Run the
r.shscript to assemble, compile, and link the program:./r.sh
Execute the generated my.out executable to launch the calculator:
./my.out
Nolan Delligatta CPSC 240-03 Contact: ndelligatta@csu.fullerton.edu
harmonic.asm: Assembly code for harmonic sum calculation. statistics.c: C driver program that coordinates the calculator's functionality. isfloat.cpp: C++ code for validating floating-point input. reciprocal_sum.cpp: C++ code for calculating reciprocal sum. r.sh: Bash script for assembling, compiling, and linking the program.
This project was created as a part of CPSC 240 Assembly course. The hybrid programming approach demonstrates the synergy of assembly, C, and C++ for efficient and functional programming.