编写一个简单程序运行一下就消失,应该在什么位置添加什么代码。

#include
#include
using namespace std;
int main()
{
cout << "Enter two numbers:" << endl;
int V1 = 0, V2 = 0;
cin >> V1 >> V2;
cout << "The number of" << V1 << "and" << V2 << "is" << V1 + V2 << endl;
return 0;
}

在最后加上system("pause"); 记得头文件stdlib.h

 #include<iostream>
#include<stdlib.h>
using namespace std;
int main()
{
    cout << "Enter two numbers:" << endl;
    int V1 = 0, V2 = 0;
    cin >> V1 >> V2;
    cout << "The Sum of " << V1 << " and " << V2 << " is: " << V1 + V2 << endl;
    system("pause");
    return 0;
}

最后一句加一个断点就可以了嘛

添加头文件stdlib.h,然后return前加上system("pause");

学编程应该知道程序是可以调试的。
打断点,打在哪儿就会停到哪儿。然后跟踪代码

对于c语言就行楼上说的你可以加pause暂停