- 4
- 0
- 约5.24千字
- 约 11页
- 2016-12-28 发布于湖南
- 举报
6.3 实验题
一、基础题
1.分析下列程序,然后根据运行结果补充和修改一些语句,使之输出如图6-1的结果
#includeiostream
using namespace std;
void main()
{
int a=20,b=40,c=60,temp;
int x=a,y=b,z=c;
int *p1,*p2,*p3;
p1=a;
p2=b;
p3=c;
temp=*p1;*p1=*p3;*p3=temp;
coutendl;
cout一、用指向变量的指针形式输出该变量的地址:endl;
cout endl;
cout (1) 变量a的地址为:aendl;
cout (2) 变量b的地址为:bendl;
cout (3) 变量c的地址为:cendl;
coutendlendl;
cout二、用变量的别名输出该变量的值:endl;
cout endl;
cout (1) 变量a的值为:a a的别名的值为:xendl;
cout (1) 变量a的值为:a b的别名的值为:yendl
原创力文档

文档评论(0)