#include <iostream>
int main() {
std::cout << "Please enter two numbers" << std::endl;
int v1, v2 = 0;
std::cin >> v1 >> v2;
std::cout << "The sum of " << v1 << " and " << v2
<< " is " << v1 + v2 << std::endl;
std::cin.get();
return 0;
}
I added the cin.get() so that I could see the result in the terminal before it closes, but for some reason the program still closes immediately after printing the result. Is there a better way to prevent the window from closing immediately after running the code?