{"id":46160972,"url":"https://github.com/xpagedeveloper/cmdcalc","last_synced_at":"2026-03-02T11:02:07.022Z","repository":{"id":324673922,"uuid":"1098041111","full_name":"xpagedeveloper/CmdCalc","owner":"xpagedeveloper","description":"Commandline calculator","archived":false,"fork":false,"pushed_at":"2025-11-17T07:37:34.000Z","size":5,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-11-17T09:19:04.205Z","etag":null,"topics":["command-line","commandline-tool"],"latest_commit_sha":null,"homepage":"https://xpagedeveloper.com","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/xpagedeveloper.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-11-17T07:18:29.000Z","updated_at":"2025-11-17T07:39:40.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/xpagedeveloper/CmdCalc","commit_stats":null,"previous_names":["xpagedeveloper/cmdcalc"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/xpagedeveloper/CmdCalc","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xpagedeveloper%2FCmdCalc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xpagedeveloper%2FCmdCalc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xpagedeveloper%2FCmdCalc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xpagedeveloper%2FCmdCalc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/xpagedeveloper","download_url":"https://codeload.github.com/xpagedeveloper/CmdCalc/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xpagedeveloper%2FCmdCalc/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29999223,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-02T09:59:02.300Z","status":"ssl_error","status_checked_at":"2026-03-02T09:59:02.001Z","response_time":60,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["command-line","commandline-tool"],"created_at":"2026-03-02T11:02:06.236Z","updated_at":"2026-03-02T11:02:07.013Z","avatar_url":"https://github.com/xpagedeveloper.png","language":"C#","readme":"# CmdCalc\n\nCmdCalc is a small command-line calculator written in C# that targets the .NET Framework 4.8. It evaluates arithmetic expressions, understands percentages and \"of\" syntax, and can solve simple linear equations in the form ax+b=c.\n\n**Features:**\n- **Basic arithmetic:** addition, subtraction, multiplication, division and parentheses.\n- **Percent handling:** expressions like `20% of 100`, `200 - 10%`, and `50% * 3` are supported and normalized automatically.\n- **Linear equation solving:** solves simple one-variable linear equations such as `2x+4=10` or `3x-9=0`.\n- **Single-file C# project:** `Program.cs` contains the full implementation.\n\n**How it works (brief):**\n- The program concatenates CLI arguments and inspects the input.\n- If the expression contains `x`, it attempts to solve a linear equation using a regular expression. It computes `x = (c - b) / a` for expressions matching `ax+b=c`.\n- Percent expressions are expanded so that `N%` becomes `(N/100)` and patterns like `A - B%` are interpreted as `A - (A * (B/100))` when appropriate.\n- Final numeric evaluation uses `System.Data.DataTable.Compute()` to evaluate the normalized arithmetic expression.\n\nRequirements\n- Windows: .NET Framework 4.8 (Visual Studio or Developer Command Prompt)\n- Linux/macOS: Mono (for running the compiled .NET Framework executable)\n\nBuild \u0026 run\n\nWindows (Visual Studio / Developer Command Prompt):\n\n1. Open a \"Developer Command Prompt for VS\".\n2. Compile:\n\n```\ncsc -out:CmdCalc.exe Program.cs\n```\n\n3. Run:\n\n```\nCmdCalc.exe 10+6\n```\n\nLinux/macOS with Mono:\n\n1. Install Mono (if not installed): see `https://www.mono-project.com/`\n2. Compile with `mcs` (Mono C# compiler) or reuse the Windows-built `CmdCalc.exe`:\n\n```\nmcs -out:CmdCalc.exe Program.cs\nmono CmdCalc.exe 20% of 100\n```\n\nExamples and expected output\n\n- `CmdCalc 10+6`\n\t- Output: `16`\n- `CmdCalc \"20% of 100\"`\n\t- Output: `20` (expands `20% of 100` → `(20%*100)` → `0.2*100`)\n- `CmdCalc 200 - 10%`\n\t- Output: `180` (interpreted as `200 - (200*10%)` → `200 - 20`)\n- `CmdCalc ((10*3)-3)/3`\n\t- Output: `9`\n- `CmdCalc 2x+4=10`\n\t- Output: `3` (solves for `x`)\n- `CmdCalc 3x-9=0`\n\t- Output: `3` (solves for `x`)\n\nImplementation notes\n- Linear equations are matched with a regex: `([\\+\\-]?\\d*\\.?\\d*)x([\\+\\-]?\\d*\\.?\\d*)=([\\+\\-]?\\d*\\.?\\d*)`.\n- Percent normalization converts `N%` into `(N/100)` using invariant culture to ensure consistent decimal parsing.\n- Expression evaluation uses `DataTable.Compute` — this keeps the expression parsing simple but means the evaluator is tied to the behaviors of `Compute`.\n\nContributing\n- Feel free to open issues or pull requests. Small, focused changes are easiest to review.\n\nLicense\n- Apache 2.0 license\n\nAuthor\n- CmdCalc by Fredrik Norling, XPageDeveloper (2025)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxpagedeveloper%2Fcmdcalc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxpagedeveloper%2Fcmdcalc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxpagedeveloper%2Fcmdcalc/lists"}