p1-45.cpp
来自「c++200源代码」· C++ 代码 · 共 28 行
CPP
28 行
#include<iostream.h>
main()
{
//声明变量和指针变量
int a,b,c,*ip;
//指针变量ip指向变量a
a=100;
ip=&a; //使指针变量 ip 指向变量a
cout<<"a="<<a<<endl;
cout<<"*ip="<<*ip<<endl;
cout<<"ip="<<ip<<endl;
//指针变量ip指向变量b
ip=&b; //使指针变量 ip 指向变量b
b=200;
cout<<"b="<<b<<endl;
cout<<"*ip="<<*ip<<endl;
cout<<"ip="<<ip<<endl;
//指针变量ip指向变量c
ip=&c; //使指针变量 ip 指向变量b
*ip=a+b;
cout<<"c="<<c<<endl;
cout<<"*ip="<<*ip<<endl;
cout<<"ip="<<ip<<endl;
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?