Why do i need to use cin.get twice ??

Hey guys, i was writing a very simple program and came a across an problem. In order to stop my program from closing i had to use cin.get () twice? Is this normal ? here is my code -

int main()
int a;
int b;
int sum;

cout << "To start this addition calculator, please enter a number!" << endl << endl;

cin >> a;

cout << "Now enter another number !" << endl << endl;

cin >> b;

sum = a + b;

cout << "The sum of those two numbers is " << sum << endl << endl;

cout << "This program was created by Omar Ismail" << endl <<endl;

cout << "Press enter to continue..." ;

cin.get ();
cin.get ();

return 0;

Oh and also, don't post alternatives to cin.get. Thanks :)
cin >> b;

This leaves extra junk in the buffer. Try inputting 2xyzabcdef after it and see what happens.
Topic archived. No new replies allowed.