Can someone please tell me what is wrong with this source code?
Code:
#include <iostream.h>
#include <conio.h>
int add(int a, int b);
int subt(int c, int d);
int main()
{
int input, a, b, c, d;
cout<<"1. Add 2 numbers";
cout<<"2. Subtract 2 numbers";
cout<<"3. Exit Calculator";
cin>>input;
switch (input)
{
case 1:
{
cout<<"Enter two numbers to be added: ";
cin>>a>>b;
cout<<"The sum of your two numbers is: "<<add(a, b);
cin.get();
return 0;
}
int add(int a, int b)
{
cin.get();
return a+b;
}
break;
case 2:
{
cout<<"Enter two numbers to be subtracted: ";
cin>>c>>d;
cout<<"The difference of your two numbers is: "<<subt(c, d);
cin.get();
return 0;
}
int subt(int c, int d);
{
cin.get();
return c-d;
}
break;
case 3:
return 0;
default:
cout<<"Error, bad input, quitting";
}
return 0;
}
I'm getting the following errors...
Line 23: Parse error before {
Line 27: Break Statement not within loop or switch
Line 28: case label 2 not within loop or switch statement
Thank you in advance for any help!