【发布时间】:2011-02-13 03:01:45
【问题描述】:
可能重复:
How to stop C++ console application from exiting immediately?
所以我学习 c++,我得到了这个例子,我想运行它。但我不能让它熬夜,除非我改变它。我如何让 Microsoft Visual 2010 在我发布它后在程序结束时保持屏幕保持?
#include<iostream>
using namespace std;
int area(int length, int width); /* function declaration */
/* MAIN PROGRAM: */
int main()
{
int this_length, this_width;
cout << "Enter the length: "; /* <--- line 9 */
cin >> this_length;
cout << "Enter the width: ";
cin >> this_width;
cout << "\n"; /* <--- line 13 */
cout << "The area of a " << this_length << "x" << this_width;
cout << " rectangle is " << area(this_length, this_width);
return 0;
}
/* END OF MAIN PROGRAM */
/* FUNCTION TO CALCULATE AREA: */
int area(int length, int width) /* start of function definition */
{
int number;
number = length * width;
return number;
} /* end of function definition */
/* END OF FUNCTION */
【问题讨论】:
-
这个问题以前在这里问过:stackoverflow.com/questions/2529617/…(那里列出了几个解决方案)。
标签: c++ visual-c++ visual-c++-2010