#include<iostream.h>
#include<math.h>
#include<conio.h>
#include<stdio.h>
#include<string.h>//is this neccesory
int main()
{
int add,sub,answer,done;
labelA:
cout<<"whats is the basic mathamatical operation you want to perform? \n";
cout<<"please answer with add-for addition sub-for subtraction.\n";//program prints this then become unresponsive.when the applications "close on exit" is unchecked from the properties.when it checked closes automatically.
cin<<answer;
if (answer==add)
{
//program of addition
long double value1;
long double value2;
long double output1;
cout<<"Enter first number for addition. \n";
cin>>value1;
cout<<"Enter second number for addtion. \n";
cin>>value2;
output1=value1+value2;
cout<<"The sum of these two number: "<<output1;
goto labelA;
}
if (answer==sub)
{
//program of subtraction
long double sub1;
long double sub2;
long double ans2;
cout<<"Enter the first number for subtraction.\n";
cin>>sub1;
cout<<"Enter the second number for subtraction.\n";
cin>>sub2;
ans2=sub1-sub2;
cout<<"The sub of these two numbers are: "<< ans2;
goto labelA;
}
if (answer==done)
{cout<<"thank you for using this program.Good bye" <<endl;
getch();
}
return 0;
}
//any solutions will be greatly appreciated.
compiling does not shows any errors.but when i run the program.after the first two couts shows.when i input my answer to the application' its closes automatically.
yeah.many people says that.i know that i have to add loop in in the program.but i dont know.please edit the code and add loop.that would be a great help