Hello guy, i'm new here so i don't exactly know how thing are run. But anyways i was trying to create a basic calculator but i kept getting the error, "Syntax error at end of input" every time i tried to compile and run it.
If you guys could take a look and see where my mistake was, it would be greatly appreciated.
Code:
#include <stdio.h>
#include <stdlib.h>
#include <conio.h>
#include <math.h>
int Addition(int x, int y);
int Subtraction(int x, int y);
int Multiplication(int x, int y);
int Division(int x, int y);
int main( void ) {
int choice;
int num1;
int num2;
int answer;
int exit;
int x;
int y;
int yes = 0;
int no = 1;
Start:
system("CLS");
system("COLOR 4F");
printf(" Welcome to Zach's Commandline Equation Calculator!\n");
printf("\n\nInsert the number of the type of equation you wish to be calculated:\n");
printf("1- Addition\n");
printf("2- Subtraction\n");
printf("3- Multiplication\n");
printf("4- Division\n");
printf("5- Exit Calculator");
scanf("%d,\n", &choice, "\n");
switch(choice)
{
case 1:
printf("\n");
scanf("%d%d", &num1, &num2);
printf("\n\n%d", addition(num1, num2));
getchar();
goto Start;
break;
case 2:
printf("\n");
scanf("%d%d", &num1, &num2);
printf("\n\n%d", subtraction(num1, num2));
getchar();
goto Start;
break;
case 3:
printf("\n");
scanf("%d%d", &num1, &num2);
printf("\n\n%d", multiplication(num1, num2));
getchar();
goto Start;
break;
case 4:
printf("\n");
scanf("%d%d", &num1, &num2);
printf("\n\n%d", division(num1, num2));
getchar();
goto Start;
break;
case 5:
printf("\nAre you sure you want to exit from this operation?\n");
printf("\n0 - yes\n1 - no");
scanf("%d", &exit);
if(exit == yes)
{
system("EXIT");
}
else if (exit == no)
{
goto Start;
}
else
{
goto Start;
}
break;
default:
{
goto Start;
break;
}
getch();
return 0;
}
Also, any improvements would be greatly appreciated.