5_8.cpp

来自「清华大学C++补充习题代码」· C++ 代码 · 共 28 行

CPP
28
字号
//5_8.cpp
#include <iostream>
using namespace std;
class Exam
{
public:
	Exam()	{cout<<"Calling Constructor"<<endl;}
};
void fun(int i)
{
	static Exam e;
	cout<<"The i is :"<<i<<endl;
}

int main()
{ 
	fun(10);
	fun(20);
	fun(30);
	return 0;
}
/*
程序运行结果为:
Calling Constructor
The i is :10
The i is :20
The i is :30
*/

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?