program_6_5.cpp
来自「本程序为visual c++课件讲义」· C++ 代码 · 共 28 行
CPP
28 行
// program 6.5: Demonstrate call by reference
#include <iostream>
using namespace std;
void Mystery(int a, int &b) {
cout << "Output at beginning of Mystery" << endl;
cout << "a is " << a << endl;
cout << "b is " << b << endl;
a = 5;
b = 6;
cout << "Output after Mystery assignments" << endl;
cout << "a is " << a << endl;
cout << "b is " << b << endl;
return;
}
int main() {
int i = 10;
int j = 20;
cout << "Output at beginning of main" << endl;
cout << "i is " << i << endl;
cout << "j is " << j << endl;
Mystery(i, j);
cout << "Output after Mystery returns" << endl;
cout << "i is " << i << endl;
cout << "j is " << j << endl;
return 0;
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?