```
OK, I've organized it with functions but there are quite a few things wrong with it and I can't seem to catch them.
#include <iostream.h>
int main()
{
cout<<"*************************************************************************";
cout<<"******* ** ** ****** ** *** ** **** ** ** ** *******";
cout<<"******* ****** *** ** ****** ****** *** ** **** *** **** **** *** ** *** *******";
cout<<"** ** ****** ** ****** ****** *** ** **** **** **** *** ** ** **";
cout<<"******* ****** *** ** ****** ****** *** ** **** *** **** **** *** ** ** ********";
cout<<"******* ** *** ** ** ** ** ** *** **** **** ** *** *******";
cout<<"**************************************************************************";
cout<<"**********Enter 1 to Add, 2 to Subtract, 3 to Multiply, or 4 to Divide**********";
cout<<endl;
start:
cout<<"Choose the number of your operation then press Enter: ";
int choice;
cin>>choice;
if (choice == 1)
bool status = addition();
return (int)status;
goto start;
if (choice == 2)
bool status = subtraction();
return (int)status;
goto start;
if (choice == 3)
bool status = multiplication();
return (int)status;
goto start;
if (choice == 4)
bool status = division();
return (int)status;
goto start;
if (choice >4)
goto start;
}
bool adding()
{
cout<<"Addition-";
cout<<"Enter first number: ";
int first;
cin>>first;
cout<<"Enter second number: ";
int second;
cin>>second;
cout<<"Answer: ";
cout<<first + second;
cout<< endl;
}
bool subtraction()
{
cout<<"Subtraction-";
cout<<"Enter first number: ";
int first1;
cin>>first1;
cout<<"Enter second number: ";
int second1;
cin>>second1;
cout<<"Answer: ";
cout<<first1 - second1 ;
cout<< endl;
}
bool multiplication()
{
cout<<"Multiplication-";
cout<<"Enter first number: ";
int first2;
cin>>first2;
cout<<"Enter second number: ";
int second2;
cin>>second2;
cout<<"Answer: ";
cout<<first2 * second2 ;
cout<< endl;
}
bool division()
{
cout<<"Division-";
cout<<"Enter first number: ";
int first3;
cin>>first3;
cout<<"Enter second number: ";
int second3;
cin>>second3;
cout<<"Answer: ";
cout<<first3 / second3;
cout<< endl;
}
Errors:
--------------------Configuration: CALC - Win32 Debug--------------------
Compiling...
calc.cpp
H:\COMP PROGRAMMING\C++ CHAPTERS\CALC\calc.cpp(20) : error C2065: 'addition' : undeclared identifier
H:\COMP PROGRAMMING\C++ CHAPTERS\CALC\calc.cpp(20) : warning C4800: 'int' : forcing value to bool 'true' or 'false' (performance warning)
H:\COMP PROGRAMMING\C++ CHAPTERS\CALC\calc.cpp(21) : error C2065: 'status' : undeclared identifier
H:\COMP PROGRAMMING\C++ CHAPTERS\CALC\calc.cpp(24) : error C2065: 'subtraction' : undeclared identifier
H:\COMP PROGRAMMING\C++ CHAPTERS\CALC\calc.cpp(24) : warning C4800: 'int' : forcing value to bool 'true' or 'false' (performance warning)
H:\COMP PROGRAMMING\C++ CHAPTERS\CALC\calc.cpp(28) : error C2065: 'multiplication' : undeclared identifier
H:\COMP PROGRAMMING\C++ CHAPTERS\CALC\calc.cpp(28) : warning C4800: 'int' : forcing value to bool 'true' or 'false' (performance warning)
H:\COMP PROGRAMMING\C++ CHAPTERS\CALC\calc.cpp(32) : error C2065: 'division' : undeclared identifier
H:\COMP PROGRAMMING\C++ CHAPTERS\CALC\calc.cpp(32) : warning C4800: 'int' : forcing value to bool 'true' or 'false' (performance warning)
H:\COMP PROGRAMMING\C++ CHAPTERS\CALC\calc.cpp(53) : error C2373: 'subtraction' : redefinition; different type modifiers
H:\COMP PROGRAMMING\C++ CHAPTERS\CALC\calc.cpp(66) : error C2373: 'multiplication' : redefinition; different type modifiers
H:\COMP PROGRAMMING\C++ CHAPTERS\CALC\calc.cpp(79) : error C2373: 'division' : redefinition; different type modifiers
Error executing cl.exe.
CALC.exe - 8 error(s), 4 warning(s)
```