Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

A simple command-line calculator written in Swift. My first Swift project.

Notifications You must be signed in to change notification settings

code-solves/swift-cli-calculator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

History

1 Commit

Repository files navigation

Swift CLI Calculator

Swift

A simple command-line calculator built in Swift.
This is my first Swift project — a small but fun way to learn the language.


Features

  • Basic arithmetic: addition, subtraction, multiplication, and division
  • Input validation (handles invalid numbers and division by zero)
  • Clean CLI interface
  • Easily extendable for new operations

Usage

  1. Clone the repository:

    git clone https://github.com/YOUR_USERNAME/swift-cli-calculator.git
    cd swift-cli-calculator
  2. Run the calculator:

    swift main.swift

Example:

Welcome to Swift CLI Calculator!
Enter first number: 5
Enter second number: 3
Choose operation (+, -, *, /): *
Result: 15

Project Structure

swift-cli-calculator/
│── main.swift # Source code
│── README.md # Project documentation
│── .gitignore # Ignored files

Roadmap

  • Add support for more operations (modulus, power, square root)
  • Allow continuous calculations until user exits
  • Format results with decimals
  • Add tests

License

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

About

A simple command-line calculator written in Swift. My first Swift project.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

AltStyle によって変換されたページ (->オリジナル) /