quiz08-2-2.cpp

来自「数据结构常用算法合集」· C++ 代码 · 共 24 行

CPP
24
字号
//quiz08-2-2.cpp
#include <iostream.h>
#include <conio.h>
#include <iomanip.h>
int side_effect(int *, int&);
void main()
{ int a=10,*ptr,c;
  ptr = new int;
  c=side_effect(ptr,a);
  cout << a<<setw(4)<<*ptr<<setw(4)<<c<<endl;//_____  _____  _____ (15%)
  a++;
  c=*ptr + a;
  cout << a<<setw(4)<<*ptr<<setw(4)<<c<<endl;//_____  _____  _____ (15%)
  delete ptr;
  getch();
}
int side_effect(int *a,int &b)
{ *a = 2;
  b = b * *a;
  return (b+1);
}


⌨️ 快捷键说明

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