You can run the program from the command line instead. If you really wish to run it from Dev-C++, you would need to keep the window open by pausing. One way is to wait for input, e.g.,
Code:
std::cout << "Sum is " << sum << std::end1;

std::cin.ignore(); // Ignore the newline character in the input buffer.
std::cin.get();    // Wait for the user to press enter.

return 0;