📄 p1-45.cpp
字号:
#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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -