minaadel1994
07-25-2008, 11:35 PM
hi , i have got a problem with this calculator , why when i cant calculate twice.... or more , it automaticly closes help plz heres the code:
//here it starts
#include <iostream>
using namespace std;
int subs (int x, int y);
int add (int x, int y);
int divi (int x, int y);
int mult (int x, int y);
int main()
{
int x;
int y;
cout<<"please input a number then press space and the other number to calculate: \n";
cin>>x>>y;
cin.ignore();
cout<<"equals (substracted) : "<< subs (x,y)<<"\n";
cout<<"equals (added) : "<< add (x,y)<<"\n";
cout<<"equals: (divied) : "<< divi (x,y)<<"\n";
cout<<"equals:(multiplyed) : "<< mult (x,y)<<"\n";
cin.get();
}
int subs (int x, int y)
{
return x - y;
return 0;
}
int add (int x, int y)
{
return x + y;
return 0;
}
int divi (int x, int y)
{
return x / y;
return 0;
}
int mult (int x, int y)
{
return x * y;
return 0;
}
// ends here
now wots wrong?? or wot should i add to prevent it from automaticly closing itself
//here it starts
#include <iostream>
using namespace std;
int subs (int x, int y);
int add (int x, int y);
int divi (int x, int y);
int mult (int x, int y);
int main()
{
int x;
int y;
cout<<"please input a number then press space and the other number to calculate: \n";
cin>>x>>y;
cin.ignore();
cout<<"equals (substracted) : "<< subs (x,y)<<"\n";
cout<<"equals (added) : "<< add (x,y)<<"\n";
cout<<"equals: (divied) : "<< divi (x,y)<<"\n";
cout<<"equals:(multiplyed) : "<< mult (x,y)<<"\n";
cin.get();
}
int subs (int x, int y)
{
return x - y;
return 0;
}
int add (int x, int y)
{
return x + y;
return 0;
}
int divi (int x, int y)
{
return x / y;
return 0;
}
int mult (int x, int y)
{
return x * y;
return 0;
}
// ends here
now wots wrong?? or wot should i add to prevent it from automaticly closing itself