以下是相同案例的代码.
#include <iostream>
#include <fstream>
using namespace std;
int main () {
ofstream myfile;
myfile.open ("example.txt");
myfile << "Writing this to a file.\n";
//myfile.close();
return 0;
}
Run Code Online (Sandbox Code Playgroud)
如果我取消注释该myfile.close()行,会有什么不同?
#include <iostream>
int main(){
std::cout << main << std::endl;
return 0;
}
Run Code Online (Sandbox Code Playgroud)
为什么在命令行中打印1?
这是代码
int main()
{
const int i = 2;
const int * pi = &i;
int* j = const_cast<int *> (pi);
*j = 11;
std::cout << *pi << std::endl;
std::cout << i << std::endl;
return 0;
}
Run Code Online (Sandbox Code Playgroud)
结果:
11
2 <---为什么?
我也有同样的疑问……如何在后台运行测试用例来测试 AUT,以便我可以在我的机器上处理其他一些任务。虽然在 squish 中的测试运行着如此多的弹出窗口,并且 AUT 功能不断出现在您的屏幕上,并且在您处理其他事情时很烦人。