Em1l1ko Ответов: 3

Как мне улучшить свой проект, который я назвал универсальным калькулятором?


Итак, у меня появилась идея создать проект на языке Си, который я назвал универсальным калькулятором. В основном, это код, который помогает решать общие задачи и вычисления в математике. Она состоит из main.cpp и метод.c. Он работает без каких-либо ошибок. Не могли бы вы подсказать мне, как я могу улучшить свой проект, потому что я хочу разместить его где-нибудь (например, на github), или использовать этот код для создания программного обеспечения, или использовать его в качестве плагина на веб-сайте.

Что я уже пробовал:



main.cpp:
//Emil Ahmadov
//Program language C
//Universal Calculator

#include <stdio.h>
#include "method.c"
int main()
{
    double a;
    double b;
    int check;
    int check2;
    int check3;
    double c;
    const double pi=3.14159265359;
    printf("Welcome to the Universal Calculator\n");
    printf("Instructions: \n");
    printf("1. Choose the command\n");
    printf("2. Enter the number or numbers\n");
    printf("3. Here is your answer\n\n");
    printf("Operations with integers, decimals, radicals (press 1)\n"
           "Trigonometric operations  (press 2 )\n"
           "Solve quadratic equation (press 3)\n"
           "Math formulas (press 4)\n");
    printf("\nYour choice: ");
    scanf("%d", &check);
    while(check>4||check<1)
    {
        printf("\nWrong Command!\n");
        printf("Your choice: ");
        scanf("%d", &check);
    }
    if(check==1)
    {
        printf("\nChoose the operation:\n");
        printf("\nAddition (press 1)\nSubtraction (press 2)\nMultiplication (press 3)\nDivision (press 4)\n"
               "Raise into Power (press 5)\nExponent (press 6)\nLogarithm-base 10 (press 7)\nNatural logarithm (press 8)\n"
               "Square root (press 9)\nRound the number (press 10)\n");
        printf("\nYour choice: ");
        scanf("%d", &check3);
        while(check3>10||check3<1)
        {
            printf("\nWrong Command!\n");
            printf("Your choice: ");
            scanf("%d", &check3);
        }
        printf("\nNote: The digits entered should be either integers or decimals\n");
        if(check3==1 || check3==2 || check3==3 || check3==5)
        {
            printf("\nEnter the first number: ");
            scanf("%lf", &a);
            printf("Enter the second number: ");
            scanf("%lf", &b);
            if(check3==1)
            {
                printf("\naddition: %lf\n", add(a,b));
            }
            else if(check3==2)
            {
                printf("\nsubtraction: %lf\n", subtract(a,b));
            }
            else if(check3==3)
            {
                printf("\nmultiplication: %lf\n", multiply(a,b));
            }
            else
            {
                printf("\npower: %lf\n", power(a, b));
            }
        }
        else if(check3==4)
        {
            printf("\nEnter the first number: ");
            scanf("%lf", &a);
            printf("Enter the second number: ");
            scanf("%lf", &b);
            while(b==0)
            {
                printf("\nError! divider shouldn't be equal to zero\n");
                printf("Enter the second number again: ");
                scanf("%lf", &b);
            }
            printf("\ndivision: %lf\n", divide(a,b));
        }
        else if(check3==6 || check3==7 || check3==8 || check3==9 || check3==10)
        {
            if(check3==6)
            {
                printf("\nEnter the number: ");
                scanf("%lf", &a);
                printf("\nexponent (e^x) : %lf\n", exponent(a));
            }
            else if(check3==7)
            {
                printf("\nEnter the base of the logarithm: ");
                scanf("%lf", &a);
                while(a<=0)
                {
                    printf("\nError! Base of the logarithm should be positive\n");
                    printf("Enter the base again: ");
                    scanf("%lf", &a);
                }
                printf("\nlogarithm (base 10) : %lf\n", logarithm(a));
            }
            else if(check3==8)
            {
                printf("\nEnter the base of a natural logarithm: ");
                scanf("%lf", &a);
                while(a<=0)
                {
                    printf("\nError! Base of the logarithm should be positive\n");
                    printf("Enter the base of a natural logarithm again: ");
                    scanf("%lf", &a);
                }
                printf("\nnatural logarithm (base e) : %lf\n", nat_log(a));
            }
            else if(check3==9)
            {
                printf("\nEnter the number: ");
                scanf("%lf", &a);
                while(a<0)
                {
                    printf("\nError! Cannot take the square root from a  negative number\n");
                    printf("Enter the number again: ");
                    scanf("%lf", &a);
                }
                printf("\nsquare root: %lf\n", sq_root(a));
            }
            else
            {
                printf("\nEnter the number: ");
                scanf("%lf", &a);
                printf("\nrounded : %lf\n", round(a));
            }
        }
    }
    else if(check==2)
    {
        printf("\nChoose the operation:\n");
        printf("\nsin: press 1\ncos: press 2\ntan: press 3\nctg: press 4\nsinh: press 5\ncosh: press 6\ntanh: press 7\nctgh: press 8\n");
        printf("\nYour choice: ");
        scanf("%d", &check2);
        while(check2>8||check2<1)
        {
            printf("\nWrong Command!\n");
            printf("Your choice: ");
            scanf("%d", &check2);
        }
        if(check2==1||check2==2||check2==3||check2==4||check2==5||check2==6||check2==7||check2==8)
        {
            printf("\nEnter the angle in degrees: ");
            scanf("%lf", &c);
            double res;
            res = trig(c, check2);
            printf("\nresult is: %lf\n", res);
        }
    }
    else if(check==3)
    {
        float c1, c2, c3;
        float r1, r2;
        printf("\nNote: The digits entered should be either integers or decimals\n");
        printf("\nEnter the first coefficient: ");
        scanf("%f", &c1);
        printf("Enter the second coefficient: ");
        scanf("%f", &c2);
        printf("Enter the third coefficient: ");
        scanf("%f", &c3);
        float disc;
        disc=pow(c2, 2)-4*c1*c3;
        if(disc>0)
        {
            printf("\nRoots are real and different!\n\n");
            r1=(-c2+sqrt(disc))/(2*c1);
            r2=(-c2-sqrt(disc))/(2*c1);
            printf("first root = %f\n", r1);
            printf("second root = %f\n", r2);
        }
        else if(disc==0)
        {
            printf("\nRoots are real and same!\n\n");
            r1= (-c2+sqrt(disc))/(2*c1);
            printf("first root = second root = %f\n", r1);
        }
        else
        {
            printf("\nRoots are complex and different!\n\n");
            float realPart = (-c2)/(2*c1);
            float imagPart = sqrt(-disc)/(2*c1);
            printf("first root = %f + %fi\n",realPart, imagPart);
            printf("second root = %f - %fi\n",realPart, imagPart);
        }
    }

    else if(check==4)
    {
        int check4;
        printf("\nCalculate the average of numbers (press 1)");
        printf("\nCalculate the percent of a number (press 2)");
        printf("\nCalculate the factorial (press 3)");
        printf("\nPythagorean theorem (press 4)");
        printf("\nCalculate the perimeter (press 5)");
        printf("\nCalculate the area (press 6)");
        printf("\nCalculate the volume (press 7)\n");
        printf("\nYour choice: ");
        scanf("%d", &check4);
        while(check4>7||check4<1)
        {
            printf("\nWrong Command!\n");
            printf("Your choice: ");
            scanf("%d", &check4);
        }
        if(check4==1)
        {
            int i, n;
            double sum=0;
            double a[100];
            double avg;
            printf("\nEnter the number of digits for which you want to find the average: ");
            scanf("%d", &n);
            while (n > 100 || n <= 0)
            {
                printf("\nError! number should in range of (1 to 100).\n");
                printf("Enter the number again: ");
                scanf("%d", &n);
            }
            for(i=0; i<n; i++)
            {
                printf("Enter the digit %d: ", i+1);
                scanf("%lf", &a[i]);
                sum=sum+a[i];
            }
            avg=sum/n;
            printf("\nThe average is %lf\n", avg);
        }
        else if(check4==2)
        {
            double a;
            double b;
            double res;
            printf("\nEnter the digit: ");
            scanf("%lf", &a);
            printf("\nEnter the percentage: ");
            scanf("%lf", &b);
            res=a*b/100;
            printf("\nThe result is %lf", res);
        }
        else if(check4==3)
        {
            int k;
            long fac=1;
            printf("\nEnter a number to calculate its factorial: ");
            scanf("%d", &k);
            fac=factorial(k);
            printf("\nFactorial of %d = %ld", k, fac);
        }
        else if(check4==4)
        {
            int check5;
            double cath1;
            double cath2;
            double hyp;
            printf("\nWhich side of a right angle triangle do you want to find?\n");
            printf("hypotenuse (press 1)\n");
            printf("cathetus (press 2)\n");
            printf("\nYour choice: ");
            scanf("%d",&check5);
            while(check5>2||check5<1)
            {
                printf("\nWrong Command!\n");
                printf("\nYour choice: ");
                scanf("%d", &check5);
            }
            if(check5==1)
            {
                printf("\nEnter the first cathetus: ");
                scanf("%lf", &cath1);
                printf("Enter the second cathetus: ");
                scanf("%lf", &cath2);
                hyp=sqrt(pow(cath1,2)+pow(cath2, 2));
                printf("\nThe calculated hypotenuse: %lf", hyp);
            }
            else if(check5==2)
            {
                printf("\nEnter the hypotenuse: ");
                scanf("%lf", &hyp);
                printf("Enter the known cathetus: ");
                scanf("%lf", &cath1);
                cath2=sqrt(pow(hyp, 2)-pow(cath1,2));
                printf("\nThe calculated cathetus: %lf", cath2);
            }
        }
        else if(check4==5)
        {
            int check6;
            double sq;
            double rect1, rect2;
            double tria1, tria2, tria3;
            double rad;
            printf("\nPerimeter of which shape do you want to calculate? ");
            printf("\nsquare (press 1)");
            printf("\nrectangle (press 2)");
            printf("\ntriangle (press 3)");
            printf("\ncircle (press 4)\n");
            printf("\nYour choice: ");
            scanf("%d", &check6);
            while(check6>4||check6<1)
            {
                printf("\nWrong Command!\n");
                printf("\nYour choice: ");
                scanf("%d", &check6);
            }
            if(check6==1)
            {
                printf("\nEnter the side of a square: ");
                scanf("%lf", &sq);
                printf("\nPerimeter = %lf", 4*sq);
            }
            else if(check6==2)
            {
                printf("\nEnter the length of a rectangle: ");
                scanf("%lf", &rect1);
                printf("Enter the width of a rectangle: ");
                scanf("%lf", &rect2);
                printf("\nPerimeter = %lf", 2*(rect1+rect2));
            }
            else if(check6==3)
            {
                printf("\nEnter the first side of a triangle: ");
                scanf("%lf", &tria1);
                printf("Enter the second side of a triangle: ");
                scanf("%lf", &tria2);
                printf("Enter the third side of a triangle: ");
                scanf("%lf", &tria3);
                printf("\nPerimeter = %lf", tria1+tria2+tria3);
            }
            else if(check6==4)
            {
                printf("\nEnter the radius of a circle: ");
                scanf("%lf", &rad);
                printf("\nPerimeter = %lf", 2*pi*rad);
            }
        }
        else if(check4==6)
        {
            int check7;
            double rect1, rect2;
            double tria1, tria2, tria3;
            double sq, rad;
            double s,s1;
            double triang, constant;
            double side, h;
            double r1, r2;
            double b1, b2, h1;
            printf("\nArea of which shape do you want to calculate? ");
            printf("\nsquare (press 1)");
            printf("\nrectangle (press 2)");
            printf("\ntriangle using Heron's formula (press 3)");
            printf("\nequilateral triangle (press 4)");
            printf("\ncircle (press 5)");
            printf("\nparallelogram (press 6)");
            printf("\ntrapezoid  (press 7)");
            printf("\nellipse (press 8)\n");
            printf("\nYour choice: ");
            scanf("%d", &check7);
            while(check7>8||check7<1)
            {
                printf("\nWrong Command!\n");
                printf("\nYour choice: ");
                scanf("%d", &check7);
            }
            if(check7==1)
            {
                printf("\nEnter the side of a square: ");
                scanf("%lf", &sq);
                printf("\nArea = %lf", pow(sq,2));
            }
            if(check7==2)
            {
                printf("\nEnter the length of a rectangle: ");
                scanf("%lf", &rect1);
                printf("Enter the width of a rectangle: ");
                scanf("%lf", &rect2);
                printf("\nArea = %lf", rect1*rect2);
            }
            if(check7==3)
            {
                printf("\nEnter the first side of a triangle: ");
                scanf("%lf", &tria1);
                printf("Enter the second side of a triangle: ");
                scanf("%lf", &tria2);
                printf("Enter the third side of a triangle: ");
                scanf("%lf", &tria3);
                s=(tria1+tria2+tria3)/2;
                s1=s*(s-tria1)*(s-tria2)*(s-tria3);
                printf("\nArea = %lf", sqrt(s1));
            }
            if(check7==4)
            {
                printf("\nEnter the side of an equilateral triangle: ");
                scanf("%lf", &triang);
                constant=sqrt(3)/4;
                printf("\nArea = %lf", constant*pow(triang, 2));
            }
            if(check7==5)
            {
                printf("\nEnter the radius of a circle: ");
                scanf("%lf", &rad);
                printf("\nArea = %lf", pi*pow(rad,2));
            }
            if(check7==6)
            {
                printf("\nEnter the side of a parallelogram: ");
                scanf("%lf", &side);
                printf("Enter the height of a parallelogram: ");
                scanf("%lf", &h);
                printf("\nArea = %lf", side*h);
            }
            if(check7==7)
            {
                printf("\nEnter the first base of a trapezoid: ");
                scanf("%lf", &b1);
                printf("Enter the second base of a trapezoid: ");
                scanf("%lf", &b2);
                printf("Enter the height of a trapezoid: ");
                scanf("%lf", &h1);
                printf("\nArea = %lf", (b1+b2)*h1/2);
            }
            if(check7==8)
            {
                printf("\nEnter the first radius of an ellipse: ");
                scanf("%lf", &r1);
                printf("Enter the second radius of an ellipse: ");
                scanf("%lf", &r2);
                printf("\nArea = %lf", pi*r1*r2);
            }
        }
        else if(check4==7)
        {
            int check8;
            double sq;
            double rect1, rect2, rect3;
            double r,h;
            double b;
            double e1, e2, e3;
            double v;
            printf("\nVolume of which shape do you want to calculate? ");
            printf("\ncube (press 1)");
            printf("\nrectangular prism (press 2)");
            printf("\ncylinder (press 3)");
            printf("\npyramid (press 4)");
            printf("\ncone (press 5)");
            printf("\nsphere (press 6)");
            printf("\nellipsoid  (press 7)\n");
            printf("\nYour choice: ");
            scanf("%d", &check8);
            while(check8>7||check8<1)
            {
                printf("\nWrong Command!\n");
                printf("\nYour choice: ");
                scanf("%d", &check8);
            }
            if(check8==1)
            {
                printf("\nEnter the side of a cube: ");
                scanf("%lf", &sq);
                printf("\nVolume = %lf", pow(sq,3));
            }
            if(check8==2)
            {
                printf("\nEnter the length of a rectangular prism: ");
                scanf("%lf", &rect1);
                printf("Enter the width of a rectangular prism: ");
                scanf("%lf", &rect2);
                printf("Enter the height of a rectangular prism: ");
                scanf("%lf", &rect3);
                printf("\nVolume = %lf", rect1*rect2*rect3);
            }
            if(check8==3)
            {
                printf("\nEnter the radius of a cylinder: ");
                scanf("%lf", &r);
                printf("Enter the height of a cylinder: ");
                scanf("%lf", &h);
                printf("\nVolume = %lf", pi*pow(r,2)*h);
            }
            if(check8==4)
            {
                printf("\nEnter the side of the base of a pyramid: ");
                scanf("%lf", &b);
                printf("Enter the height of a pyramid: ");
                scanf("%lf", &h);
                printf("\nVolume = %lf", b*h/3);
            }
            if(check8==5)
            {
                printf("\nEnter the radius of the base of a cone: ");
                scanf("%lf", &r);
                printf("Enter the height of a cone: ");
                scanf("%lf", &h);
                printf("\nVolume = %lf", pi*pow(r,2)*h/3);
            }
            if(check8==6)
            {
                printf("\nEnter the radius of a cone: ");
                scanf("%lf", &r);
                printf("\nVolume = %lf", 4/3*pi*pow(r,3));
            }
            if(check8==7)
            {
                printf("\nEnter the first radius of an ellipsoid: ");
                scanf("%lf", &e1);
                printf("Enter the second radius of an ellipsoid: ");
                scanf("%lf", &e2);
                printf("Enter the third radius of an ellipsoid: ");
                scanf("%lf", &e3);
                printf("\nVolume = %lf", 4/3*pi*e1*e2*e3);
            }
        }
    }
    printf("\n\nThanks for using the Universal Calculator!\n");
    return 0;
}


метод.с:

#include <stdio.h>
#define _USE_MATH_DEFINES
#include <math.h>

double add(double a, double b)
{
    return a+b;
}

double subtract(double a, double b)
{
    return a-b;
}

double multiply(double a, double b)
{
    return a*b;
}

double divide(double a, double b)
{
    return a/b;
}

double power(double a, double b)
{
    if(a==0)
    {
        return 0;
    }
    else if(b==0)
    {
        return 1;
    }
    else if(b<0)
    {
        long double c;
        int sign;
        sign= (-1);
        b*=sign;
        c = 1/(pow(a,b));
        return c;
    }
    else
    {
        long double d=pow(a, b);
        return d;
    }
}

double exponent(double a)
{
    return exp(a);
}

double nat_log(double a)
{
       return log(a);
}

double logarithm(double a)
{
        return log10(a);
}

double sq_root(double a)
{
    return sqrt(a);
}

double trig(double c, int check2)
{
    const double pi=3.14159265359;
    c=c*pi/180;
    if(check2==1)
    {
        return sin(c);
    }
    else if(check2==2)
    {
        return cos(c);
    }
    else if(check2==3)
    {
        return tan(c);
    }
    else if(check2==4)
    {
        return (1/tan(c));
    }
    else if(check2==5)
    {
        return sinh(c);
    }
    else if(check2==6)
    {
        return cosh(c);
    }
    else if(check2==7)
    {
        return tanh(c);
    }
    else if(check2==8)
    {
        return (1/tanh(c));
    }
    else
    {
        printf("Wrong Command!");
    }
}

double percentage(double a, double p)
{
    return a*p/100;
}

long factorial(int a)
{
    long fact=1;
    int i;
    for(i=1; i<=a; i++)
    {
        fact=fact*i;
    }
    return fact;
}

Dave Kreskowiak

Я понимаю, что ты гордишься своими достижениями. Но не размещайте этот код нигде. Вы не собираетесь повторно использовать ни одну строку в "реальном" приложении или даже в лучшем приложении для калькулятора.

По мере накопления опыта вы будете оглядываться на этот код и смеяться над тем, что вы его написали, а затем выбрасывать его в мусорное ведро и писать что-то лучше. Затем пройдет еще несколько лет, и вы будете делать это снова, и снова, и снова.

Мы все так делаем.

BillWoodruff

Поздравляю, и я надеюсь, что это личное лучшее мотивирует вас продолжать учиться-экспериментировать-наблюдать-анализировать-переписывать-тестировать-повторять ... навсегда.

KarstenK

Вы также можете использовать ввод символов, и поэтому пользователь может непосредственно использовать операторы"+ -/*". Используйте константы, а не целые числа. Проверьте, что вы никогда не делите с нулем!!!

3 Ответов

Рейтинг:
23

Rick York

Проблема(ы) размещения вашего кода была рассмотрена другими, поэтому я дам вам несколько небольших предложений, чтобы помочь улучшить его.

Во-первых, вы включили math.h и добавили определение USE_MATH_DEFINES, прежде чем сделать это. Учитывая это, почему вы определили Пи? Это то, что USE_MATH_DEFINES делает для вас. Вы получаете значение под названием M_PI, определенное таким образом, что вам не нужно в дополнение к нескольким другим полезным определениям, таким как e и квадратный корень из двух.

Во-вторых, включение метода.c в другой модуль-это плохой тон. Это полностью разрушает цель наличия нескольких модулей кода. Это должно быть сделано с помощью заголовка, который определяет прототипы ваших функций. Если вы хотите написать "методы" на языке Си, то вам нужно заключить их прототипы в оболочку "extern" C", подобную этой:

extern "C"
{
// function prototypes go here
}
Я не могу придумать хорошей причины для этого, кроме как создать библиотеку с методами, которые можно было бы использовать на других языках. Тогда вам нужно сделать это именно так. В противном случае просто напишите методы на языке c++ и используйте их, как любые другие функции с заголовком, определяющим их прототипы. Вот пример прототипов функций в заголовке :
extern double add(double a, double b);
extern double subtract(double a, double b);
Еще одна вещь : возможно, вы захотите пересмотреть свою степенную функцию, потому что pow прекрасно справляется с отрицательными показателями, поэтому вам не нужно делать для них ничего особенного.


BillWoodruff

+5

Rick York

Большое спасибо.

Рейтинг:
20

OriginalGriff

О боже ... как раз то, что нужно миру, еще один консольный калькулятор.
Я собираюсь быть честным здесь, и это будет звучать жестоко - это не так, но я пытаюсь помешать вам совершить большую ошибку, о которой вы будете сожалеть очень, очень долго ... помните, что ничто в интернете по-настоящему не исчезает.

консольный калькулятор - Google Search[^]
1,000,000,000 просмотров. Это самый большой результирующий набор, который у меня есть всегда видимый на Google. Не один миллион просмотров: один миллиард хиты. Это одна веб-страница на каждые семь человек, живущих на этой планете.
:OMG:
Подумайте об этом на минуту.

Это стандартная плата за домашнее задание для студентов: каждый учитель дает его каждому студенту; каждый студент действительно гордится тем, что он сделал. Даже если источник выглядит как студенческий код, который он будет ужасно смущен через шесть месяцев, когда он оглянется на него глазами опыта.

Хорошо поработав над его написанием, я надеюсь, что вы получите хорошую оценку на своем курсе.
Но не публикуйте его для всех, он действительно не имеет никакой пользы для кого-либо еще в реальном мире.

Вы, вероятно, возненавидите меня за это, и я могу это понять. Но... ты можешь вернуться через полгода и поблагодарить меня.


Em1l1ko

Я получил Вас, thx для вашей обратной связи, но rn я заинтересован в создании полезного проекта, используя свои знания кодирования (Java и C). Что вы можете мне предложить?

OriginalGriff

Сначала получите гораздо больше опыта.
Это не только поможет вам создавать лучший код, но и облегчит работу с масштабом проекта, которым вы занимаетесь, - потому что вы поймете стратегии, которые можно использовать для того, чтобы сделать кодирование больших проектов более простым и надежным / ремонтопригодным (помните: если вы выпускаете полезный инструмент, люди будут ожидать, что вы будете поддерживать и улучшать его; в отличие от домашней работы, где это "пиши и забудь", вы будете работать с одной и той же кодовой базой в течение пяти лет или более!)

And you must be aware that almost nobody uses console based apps anymore, certainly not for user-interfaced tools. Instead, they are all very very much Graphical User Interface (or GUI for short) based, and that means you need to learn how to code them proficiently, and even the simplest GUI C# app will need to understand a huge wealth of controls, with their associates properties, methods, events, delegates, and interfaces. Add to that the "behind the scenes" classes that you will need - File I/O, databases, collections, ... the list goes on! There is a lot to learn if you want to release useful software (if only because you are coming "late to the game" so there is loads of existing software your app will be compared with).
А C - плохой выбор для приложений на основе графического интерфейса-вы можете это сделать, но это серьезный объем работы, и кривая обучения имеет вид "кирпичной стены"! Более современный язык, такой как C# или даже VB, делает его намного проще, позволяя вам сосредоточиться на приложении, а не на системе.

Начните с продолжения вашего курса и хорошо изучите следующие этапы - это действительно принесет вам пользу в долгосрочной перспективе, чтобы не спешить с этим!

Когда у вас будет больше опыта, подумайте о том, чтобы написать статью или совет

https://www.codeproject.com/script/Articles/Submit.aspx

о чем-то вы хорошо узнали и видите, как это воспринимается. Это займет меньше времени (хотя все равно дни, а не минуты), но вы получите более реалистичную обратную связь о том, как работает ваш код. Однако проверьте как точность, так и существующие статьи!
Вот один из моих:
https://www.codeproject.com/Articles/728836/Using-struct-and-class-whats-that-all-about-2
И вот совет (который является гораздо более короткой, более сфокусированной на коде статьей):
https://www.codeproject.com/Tips/1042055/Creating-a-Simple-scratch-card-Control-in-WinForms

Сравните этот код с вашим, и вы начнете понимать, почему вы будете морщиться через шесть месяцев! :смеяться:

Удачи - дайте нам знать, как у вас идут дела!

Рейтинг:
2

Patrice T

Цитата:
Как мне улучшить свой проект, который я назвал универсальным калькулятором?

Как студент, этот проект очень хорош для вас и вашего обучения/обучения, поскольку вы можете расширить его и добавить функциональные возможности.
Назвать его "универсальным" означает, что он должен сравниваться с лучшими реальными калькуляторами и может быть графическими моделями. Давайте посмотрим правде в глаза, ваш код очень и очень далек от того, что существует.
Они поддерживают интересные вещи, такие как:
- формулы свободного формата, это подразумевает работу компилятора и сопоставление скобок.
- именованные переменные.
- ПРАЙМ/не Прайм. Целочисленная Факторизация.
- бесконечные целые числа, бесконечные поплавки, комплексные числа..
- КАС, чтобы справиться с символическими вещами. Если его кормить A2-B2, он может расшириться до (A+B)*(A-B), и это всего лишь простой пример.

Для информации, разработка кода для реального калькулятора, такого как HP Prime или TI Nspire, занимает годы для команды полностью опытных программистов.

Я думаю, что основной интерес этого проекта заключается в том, чтобы улучшить ваши навыки и подготовку.
Совместное использование вашего кода представляет лишь небольшой интерес.