{"id":15031033,"url":"https://github.com/kernferm/rust-cl-calculator","last_synced_at":"2026-04-09T10:04:36.479Z","repository":{"id":255280655,"uuid":"849104468","full_name":"KernFerm/rust-cl-calculator","owner":"KernFerm","description":"Welcome to the Rust Command-Line Calculator! This is a simple command-line application written in Rust that allows you to perform basic arithmetic operations.","archived":false,"fork":false,"pushed_at":"2024-08-29T18:22:01.000Z","size":4657,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-13T09:44:23.672Z","etag":null,"topics":["application","calculator","command-line","rust-lang"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/KernFerm.png","metadata":{"files":{"readme":"README.MD","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-08-29T01:38:13.000Z","updated_at":"2024-09-10T02:07:33.000Z","dependencies_parsed_at":"2024-08-29T02:48:13.939Z","dependency_job_id":"3d44a67c-8ea7-4fde-9bdc-3228bd88bc5f","html_url":"https://github.com/KernFerm/rust-cl-calculator","commit_stats":null,"previous_names":["kernferm/calculator-n-rust","kernferm/rust-cl-calculator"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KernFerm%2Frust-cl-calculator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KernFerm%2Frust-cl-calculator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KernFerm%2Frust-cl-calculator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KernFerm%2Frust-cl-calculator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/KernFerm","download_url":"https://codeload.github.com/KernFerm/rust-cl-calculator/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243382783,"owners_count":20282007,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["application","calculator","command-line","rust-lang"],"created_at":"2024-09-24T20:14:45.582Z","updated_at":"2025-12-28T10:57:59.311Z","avatar_url":"https://github.com/KernFerm.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Rust Command-Line Calculator\r\n\r\nWelcome to the Rust Command-Line Calculator! This is a simple command-line application written in Rust that allows you to perform basic arithmetic operations.\r\n\r\n# Join the discord if you need help \r\n\r\n[https://fnbubbles420.org/discordinvite](https://fnbubbles420.org/discordinvite)\r\n\r\n\r\n## Features\r\n\r\n- Addition\r\n- Subtraction\r\n- Multiplication\r\n- Division\r\n- Percentage\r\n- SquareRoot\r\n- Modulus\r\n- Power\r\n\r\n## Screenshot\r\n\r\n![Screenshot 1 of Rust Calculator](https://github.com/KernFerm/calculator-n-rust/blob/main/screenshots/Screenshot-1.png)\r\n![Screenshot 2 of Rust Calculator](https://github.com/KernFerm/calculator-n-rust/blob/main/screenshots/Screenshot-2.png)\r\n![Screenshot 3 of Rust Calculator](https://github.com/KernFerm/calculator-n-rust/blob/main/screenshots/Screenshot-3.png)\r\n![Screenshot 4 of Rust Calculator](https://github.com/KernFerm/calculator-n-rust/blob/main/screenshots/Screenshot-4.png)\r\n\r\n\r\n## Prerequisites\r\n\r\n- [Rust](https://www.rust-lang.org/tools/install) (Make sure you have Rust installed on your machine)\r\n- **`WINDOWS OS`**\r\n\r\n## How to Use\r\n\r\n1. **Download the project files**:\r\n    - Download the project files from the provided source (e.g., a ZIP file).\r\n    - Extract the files to a directory of your choice.\r\n\r\n2. **Navigate to the project directory**:\r\n    ```sh\r\n    cd \u003cproject-directory\u003e\r\n    ```\r\n\r\n3. **Build the project**:\r\n    ```sh\r\n    cargo build\r\n    ```\r\n\r\n4. **Run the project**:\r\n    ```sh\r\n    cargo run\r\n    ```\r\n\r\n5. **Using the Calculator**:\r\n    - When you run the program, you will be greeted with a welcome message.\r\n    - You will be prompted to enter the first number. Type the number and press Enter.\r\n    - Next, you will be prompted to enter an operator. Choose from the following:\r\n        - `+` for addition\r\n        - `-` for subtraction\r\n        - `*` for multiplication\r\n        - `/` for division\r\n    - Finally, you will be prompted to enter the second number. Type the number and press Enter.\r\n    - The result of the operation will be displayed.\r\n    - You can continue performing calculations or type `q` to quit the program.\r\n\r\n## Example\r\n\r\nWelcome to the Rust Command-Line Calculator!\r\n- Enter the first number (or 'q' to quit): 10 Operators:\r\n- Addition\r\n- Subtraction\r\n- Multiplication / Division Enter the operator: + Enter the second number: 5 Result: 10 + 5 = 15\r\n- Enter the first number (or 'q' to quit): q\r\n\r\n`Thank you for using the calculator! Created by Bubbles The Dev, Goodbye.`\r\n\r\n\r\n## Building on a 64-bit System\r\n\r\nThis project is built and tested on a 64-bit system. Ensure that your Rust installation is configured for 64-bit architecture. You can verify this by running:\r\n\r\n```sh\r\nrustup target list --installed\r\n```\r\n\r\n- You should see `x86_64-unknown-linux-gnu` (or a similar 64-bit target) in the list of installed targets.\r\n- **`WINDOWS OS`**\r\n\r\n## License\r\n\r\n- This project is licensed under the [MIT License](https://github.com/KernFerm/calculator-n-rust/blob/main/LICENSE). See the LICENSE file for details\r\n\r\n## Acknowledgements\r\n\r\n- Created by [Bubbles The Dev](https://www.github.com/kernferm)\r\n\r\n------\r\n\r\n-----\r\n```rust\r\nuse std::io::{self, Write};\r\n\r\nfn main() {\r\n    println!(\"Welcome to the Rust Command-Line Calculator!\");\r\n    println!(\"===========================================\\n\");\r\n\r\n    loop {\r\n        // Prompt for the first number\r\n        print!(\"Enter the first number (or 'q' to quit): \");\r\n        io::stdout().flush().unwrap(); // Ensure the prompt is printed immediately\r\n        let mut num1_str = String::new();\r\n        io::stdin().read_line(\u0026mut num1_str).expect(\"Failed to read line\");\r\n        if num1_str.trim().to_lowercase() == \"q\" {\r\n            println!(\"\\nThank you for using the calculator! Created by Bubbles The Dev, Goodbye.\");\r\n            break;\r\n        }\r\n        let num1: f64 = match num1_str.trim().parse() {\r\n            Ok(num) =\u003e num,\r\n            Err(_) =\u003e {\r\n                println!(\"⚠️  Please enter a valid number.\\n\");\r\n                continue;\r\n            }\r\n        };\r\n\r\n        // Prompt for the operator\r\n        println!(\"\\nOperators:\");\r\n        println!(\"  + : Addition\");\r\n        println!(\"  - : Subtraction\");\r\n        println!(\"  * : Multiplication\");\r\n        println!(\"  / : Division\");\r\n        println!(\"  % : Modulus\");\r\n        println!(\"  ^ : Power\");\r\n        println!(\" sqrt : Square Root\");\r\n        print!(\"\\nEnter an operator: \");\r\n        io::stdout().flush().unwrap();\r\n        let mut operator = String::new();\r\n        io::stdin().read_line(\u0026mut operator).expect(\"Failed to read line\");\r\n        let operator = operator.trim();\r\n\r\n        // Prompt for the second number if not using sqrt\r\n        let num2: f64;\r\n        if operator != \"sqrt\" {\r\n            print!(\"Enter the second number: \");\r\n            io::stdout().flush().unwrap();\r\n            let mut num2_str = String::new();\r\n            io::stdin().read_line(\u0026mut num2_str).expect(\"Failed to read line\");\r\n            num2 = match num2_str.trim().parse() {\r\n                Ok(num) =\u003e num,\r\n                Err(_) =\u003e {\r\n                    println!(\"⚠️  Please enter a valid number.\\n\");\r\n                    continue;\r\n                }\r\n            };\r\n        } else {\r\n            num2 = 0.0; // Placeholder for sqrt operation\r\n        }\r\n\r\n        // Perform the calculation\r\n        let result = match operator {\r\n            \"+\" =\u003e num1 + num2,\r\n            \"-\" =\u003e num1 - num2,\r\n            \"*\" =\u003e num1 * num2,\r\n            \"/\" =\u003e {\r\n                if num2 == 0.0 {\r\n                    println!(\"⚠️  Division by zero is not allowed.\\n\");\r\n                    continue;\r\n                }\r\n                num1 / num2\r\n            }\r\n            \"%\" =\u003e num1 % num2,\r\n            \"^\" =\u003e num1.powf(num2),\r\n            \"sqrt\" =\u003e num1.sqrt(),\r\n            _ =\u003e {\r\n                println!(\"⚠️  Invalid operator.\\n\");\r\n                continue;\r\n            }\r\n        };\r\n\r\n        // Display the result\r\n        if operator == \"sqrt\" {\r\n            println!(\"\\nResult: sqrt({}) = {}\\n\", num1, result);\r\n        } else {\r\n            println!(\"\\nResult: {} {} {} = {}\\n\", num1, operator, num2, result);\r\n        }\r\n    }\r\n}\r\n```\r\n\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkernferm%2Frust-cl-calculator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkernferm%2Frust-cl-calculator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkernferm%2Frust-cl-calculator/lists"}