I compiled a calculator, with only *, when I start the program it says that I shall put in first number, and when I put in secound it exits, how do I do so it stays? cause I don't want anyone to run it by DOS :P
I compiled a calculator, with only *, when I start the program it says that I shall put in first number, and when I put in secound it exits, how do I do so it stays? cause I don't want anyone to run it by DOS :P
Can you post the source code?
edit: Is this a console or Win 32 app?
if its a console app, then this should work.
Code:#include <stdlib.h> ... //where you want the app to pause SYSTEM("PAUSE") ...
Last edited by Death_Wraith; 05-04-2004 at 11:47 AM.
#include <iostream.h>
int mult(int x, int y);
int main()
{
int x, y;
cout<<"Please input two numbers to be multiplied: ";
cin>>x>>y;
cout<<"The product of your two numbers is "<<mult(x, y);
return 0;
}
int mult(int x, int y)
{
return x*y;
}
\\i dont know if it is console or win32 and where i shall put the code, im a newbie on c++
Maybe...
Code:#include <iostream> #include <cstdio> using namespace std; int mult(int x, int y); int main() { int x, y; cout<<"Please input two numbers to be multiplied: "; cin>>x>>y; cout<<"The product of your two numbers is "<<mult(x, y); getchar(); getchar(); return 0; } int mult(int x, int y) { return x*y; }
"Owners of dogs will have noticed that, if you provide them with food and water and shelter and affection, they will think you are god. Whereas owners of cats are compelled to realize that, if you provide them with food and water and shelter and affection, they draw the conclusion that they are gods."
-Christopher Hitchens
Thnks a lot it worked =)