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
Printable View
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")
...
#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;
}
Thnks a lot it worked =)