Click here to Skip to main content
15,914,419 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hello Please help me out , i just wanna know why the windows open and desappear that fast with out me to see what is on the screen ?

#include <iostream>

int main ()
{
	int x =5;
	int y =7;
	std::cout  << "\n";
	std::cout  << x+y << " "<< x * y;
	std::cout  << "\n";
	return 0;
}
Posted
Updated 5-Dec-09 4:29am
v2

1 solution

Hi,

Just change your code like this:

#include <iostream>

int main ()
{
	......
	
	// Add this line to hold the screen
	getchar();

        // Or you can use this instead of the above line
        std::cin.get();

	return 0;
} 


Regards
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900