#include<iostream.h>
float add(float,float);
float subtract(float,float);
float multiply(float,float);
float divide(float,float);
void main()
{
float num_1,num_2;
char select,choice;
cout << " *-:CALCULATOR PROGRAM:-* " << endl;
cout << " -**********************-"<< endl ;
cout << endl;
cout << " -:RESTRICTIONS:- \n "<< endl;
cout << "#1) PLEASE ENTER INTEGER TAYPE VALE LIKE (.......-2,-1,0,1,2,.....):" << endl;
cout << endl;
cout << "#2) PLEASE ENTER VALID OPERATOR LIKE (*,-,/,+):" << endl;
cout << "--------------------------------------------------------------" << endl;
input: cout << endl;
cout << " ENTER FIRST DIGIT : " ;
cin >> num_1;
cout << endl;
cout << "SELECT ONE OPERATION IN WHICH OF THESE (+,*,-,/) THAT YOU WANT TO OPERATE:\n\n";
cout << "YOUR SELECTED OPERATION IS: ";
cin >> select;
cout << endl;
cout << " ENTER SECOND DIGIT : ";
cin >> num_2;
cout << endl;
if ( num_1 > 3.4e-38 && num_1 < 3.4e38 && num_2 > 3.4e-38 && num_2 < 3.4e3 && select == '+' || select == '*' || select == '-' || select == '/' )
{
if ( select == '+' )
cout << " YOUR ANSWER IS: " << add(num_1,num_2);
if( select== '-' )
cout << " YOUR ANSWER IS: " << subtract(num_1,num_2);
if ( select == '*' )
cout << " YOUR ANSWER IS: " <<multiply(num_1,num_2) ;
if ( select == '/' )
cout << " YOUR ANSWER IS: " << divide(num_1,num_2);
cout << endl;
cout << "-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-"<<endl;
cout << endl;
cout << "ENTER 'y' TO CONTINUE AND 'n' TO STOP :\n" << endl;
cout << " DO YOU WANT YO CONTNUE [y/n]: ";
cin >> choice;
if ( ( choice == 'y' ) || ( choice == 'y' ) )
goto input;
}
else
cout << endl ;
cout << " INVALID INPUT!" << endl;
cout << endl;
}
float add ( float x, float y)
{
return ( x + y );
}
float subtract ( float x, float y)
{
return ( x - y );
}
float multiply ( float x, float y)
{
return ( x * y );
}
float divide ( float x, float y)
{
return ( x / y );
}