diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..920b592 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +#Object files +*.o \ No newline at end of file diff --git a/Calc.c b/Calc.c index 86a872f..29e2634 100644 --- a/Calc.c +++ b/Calc.c @@ -24,7 +24,7 @@ #include #include -#include +#include float add(float num1, float num2); @@ -34,42 +34,45 @@ float divide(float num1, float num2); int main(void) { - int choice; - float num[2]; - // / A mini dialog we are using to get the user to make a choice - printf("Welcome to the Calculator world\n"); - printf("\n Enter The Any Two Number for Calc: "); - scanf("%f%f",&num[0], &num[1]); //These are the numbers we are going to use inside of the calculator - - printf("\nEnter your choice:\n"); - printf("1. Addition of numbers\n"); - printf("2. Multiplication of numbers\n"); - printf("3. Subtraction of numbers\n"); - printf("4. Division\n"); - scanf("%d",&choice); - - - - // This function is going to be used to switch the functions if some aren't used. - switch (choice) - { - case 1: - printf("The sum is %f and %f : %f",num[0],num[1], add(num[0], num[1])); - break; - case 2: - printf("The product is %f and %f : %f",num[0],num[1], multiply(num[0],num[1])); - break; - case 3: - printf("The difference is %f and %f : %f", num[0],num[1],subtract(num[0], num[1])); - break; - case 4: - printf("The Quotient is %f and %f : %f",num[0],num[1], divide(num[0], num[1])); - break; - default: - printf("Wrong choice."); - return 1; - - } + printf("Welcome to the Calculator world\n"); + while(1) { + int choice; + float num[2]; + // / A mini dialog we are using to get the user to make a choice + + printf("\n Enter The Any Two Number for Calc: "); + scanf("%f%f",&num[0], &num[1]); //These are the numbers we are going to use inside of the calculator + + printf("\nEnter your choice:\n"); + printf("1. Addition of numbers\n"); + printf("2. Multiplication of numbers\n"); + printf("3. Subtraction of numbers\n"); + printf("4. Division\n"); + scanf("%d",&choice); + + + + // This function is going to be used to switch the functions if some aren't used. + switch (choice) + { + case 1: + printf("The sum is %f and %f : %f\n",num[0],num[1], add(num[0], num[1])); + break; + case 2: + printf("The product is %f and %f : %f\n",num[0],num[1], multiply(num[0],num[1])); + break; + case 3: + printf("The difference is %f and %f : %f\n", num[0],num[1],subtract(num[0], num[1])); + break; + case 4: + printf("The Quotient is %f and %f : %f\n",num[0],num[1], divide(num[0], num[1])); + break; + default: + printf("Wrong choice."); + return 1; + + } + } return 0; } diff --git a/Calc.exe b/Calc.exe new file mode 100644 index 0000000..5a82a9a Binary files /dev/null and b/Calc.exe differ