In the past few days, I changed the development integration environment to vs2010. I just started to use it, but I didn’t understand it very well in some places. I can solve it by consulting related documents.
Take the VS2010 debugging window flashed by the solution as follows:
[cpp] view plain copy
- #include <iostream>
- using namespace std;
- void main()
- { int add(int,int,int);
- float average(int);
- int x,y,z, sum;
- cout<< "Input x, y, z:";
- cin>>x>>y>>z;
- sum=add(x, y, z);
- cout<<"sum="<<sum<<endl;
- cout<<"average="<<average(sum)<<endl;
- // system("pause");//Prevent the system window from flickering and disappear, method one
- }
- int add (int a, int b, int c)
- {
- return (a+b+c);
- }
- float average (int s)
- {
- return (s/3.0);
- }
The above is the test code.
The solution is as follows:
If the operation performed at this time is to compile (F5), you can run the program (Ctrl+F5) first, if it still flashes, use the following method to solve it.
Method 1:
1. If it is a C++ file, write a sentence at the end of the program (before return) and add: system("pause");
2. If it is a C file, first add a header file in the program header: #include"stdlib.h"; then Write a sentence at the end of the program (before return) and add: system("pause").
Method 2:
1. Right-click the current project-Properties
2. Select Configuration Properties-Linker-System
3. Change the "Subsystem" configuration in the system options, and select the first "Console (/SUBSYSTEM:CONSOLE) in the drop-down menu )"
and then select "Start execution (not debugging)", which is ctrl+F5;
This will solve the problem of window flashing once and for all.