diff options
| author | jstmax! <87650746+MaxWasTakenYT@users.noreply.github.com> | 2024-10-17 15:58:44 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-10-17 15:58:44 +0000 |
| commit | 6ba4ea3ad379369cdc872e828187ab9b0d4c810d (patch) | |
| tree | c49ddccd7a75d42ea9340254621a0121c7b78050 /xsc.cpp | |
| parent | 18096f3864843679c298cbf5b8fc238d0c5b3efa (diff) | |
Update and rename xsc.cpp to xsc_debug.cpp
Diffstat (limited to 'xsc.cpp')
| -rw-r--r-- | xsc.cpp | 69 |
1 files changed, 0 insertions, 69 deletions
diff --git a/xsc.cpp b/xsc.cpp deleted file mode 100644 index a2a686e..0000000 --- a/xsc.cpp +++ /dev/null @@ -1,69 +0,0 @@ -#include <iostream> -#include <cstdlib> -#include <cmath> -using namespace std; - -int usage() { - // Prints usage message (help) - system("figlet XSC | lolcat"); - cout << "\neXtremelySimpleCalculator usage:\n" - << "`xsc --help` for help\n" - << "`xsc <number> <(+|-|*|/|%|^)> <number>` for basic operation calculating\n" - << "`xsc -r|--sqrt <number>` for square root calculation\n"; - return 0; -} - -int doOperation(int n1, char opx[], int n2) { - // Performs calculations, TODO: improve :) - int result; - switch (opx[1]) { - case '+': - result = n1 + n2; - break; - case '-': - result = n1 - n2; - break; - case '*': - result = n1 * n2; - break; - case '/': - result = n1 / n2; - break; - case '%': - result = n1 % n2; - break; - case '^': - result = pow(n1, n2); - break; - default: - cout << "invalid operator!\n"; - break; - } - return result; -} - -int main(int argc, char* argv[]) { - // main::Calculations(); - if (argv[1] == "-r" || argv[1] == "--sqrt") { - int result = sqrt(atoi(argv[2])); - } - else { - int result = doOperation(atoi(argv[1]), argv[2], atoi(argv[3])); - } - - // main::Handling(); - if (argv[1] == "--help" || argv[1] == "-h") { - usage(); - return 0; - } - else if (argc > 4) { - cout << "too many arguments!\n"; - usage(); - return 1; - } - else if (argc < 2) { - cout << "not enough arguments!\n"; - usage(); - return 1; - } -} |