Skip to content

About

Simple C++ console calculator for practicing arithmetic operations, user input, and switch statements.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 

Repository files navigation

C++ Calculator

A small command-line calculator built in C++ for practicing variables, user input, arithmetic operators, and switch statements.

Project Overview

The program reads two whole numbers and one arithmetic operator, performs the selected calculation through a switch statement, and prints the result.

This is a focused beginner project rather than a scientific calculator. The code is kept in one source file so the control flow is easy to follow while learning C++.

Features

Feature Details
Addition Adds two numbers with +
Subtraction Subtracts the second number from the first with -
Multiplication Multiplies two numbers with *
Division Divides the first number by the second with /
Modulus Finds the remainder for whole numbers with %
Code style Calculation logic is handled with one switch statement

Repository Structure

Calculator-Cpp/
├── calculator.cpp        # Main calculator program
├── .gitignore            # Local build files excluded from Git
└── README.md             # Project documentation

Requirements

This project was created and tested in Dev-C++. The implementation intentionally uses only the input/output stream library and a simple switch-based structure:

#include<iostream>
using namespace std;

No external packages or third-party dependencies are required.

How to Run in Dev-C++

Open calculator.cpp in Dev-C++, then choose Execute → Compile & Run. You can also press F11 to compile and run the program. Enter two numbers and an operator when the program asks for them.

Example

=== C++ Calculator ===

Supported operators: +  -  *  /  %
The modulus operator works with whole numbers only.
Enter first number: 12.5
Enter an operator: *
Enter second number: 2
Result: 25

Learning Notes

The program keeps all calculation logic in main() and uses one switch statement to select the requested operation. This straightforward structure is suitable for practicing beginner C++ fundamentals.

License

This project is available for learning and educational use.

About

Simple C++ console calculator for practicing arithmetic operations, user input, and switch statements.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages