Calculator help

hello, im very beginner at C++ and whit about 1 week studying i managed to make a calculator

i got visual C++ express 2010.

i made my calculator but it haves 1 iusse: it closes instantly when it shows the result.

it was the same iusse my "hello world" had, and used the same solution:
std::cin.ignore( std::numeric_limits<std::streamsize>::max(), '\n' );
but it doesnt seem to be working, lemme put the calculator's script just in case:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
//calculator, made whit Visual c++ express
//by: Jike AKA César.
//this program is a calculator, DUH

#include <iostream>
#include <math.h>

int FirstNumber;
int SecondNumber;

int main()
{

	std::cout << "Welcome to Jike's Calculator Alpha 1.0\nThis is a work in progress so dont except so much from this :3\n";
	std::cout << "What is your first number?";
	std::cin >> FirstNumber;
	std::cout << "What is your second number?";
	std::cin >> SecondNumber;
	std::cout << "The result is:\n";
	std::cout << FirstNumber + SecondNumber;
	std::cout << "\n";
	std::cout << "Press ENTER to continue...\n";
	std::cin.ignore( std::numeric_limits<std::streamsize>::max(), '\n' );

	return 0;

}


thanks!
The input stream still has a newline in it from inputting the second number. Try putting std::cin.sync(); right before std::cin.ignore( ... );.
thx :3
Topic archived. No new replies allowed.