NOIP2007初赛普及组_阅读程序写结果3.2

#include <iostream> 
#include <bits/stdc++.h>
using namespace std;
void fun(int *a,int *b) {	 
	int *k; //定义的指针变量k
	k=a; a=b; b=k;
} 
int main( ) {
	int a=3, b=6, *x=&a, *y=&b; 
	fun(x,y);
	cout<<a<<","<<b<<endl; 
} 

输出:__________
答案:3,6 


#include <iostream> #include <bits/stdc++.h>
using namespace std;
void fun(int *a,int *b) {	 
	int *k; //定义的指针变量k
	k=a; a=b; b=k;
	cout<<"fun="<<a<<" "<<b<<endl;
} 
int main( ) {
	int a=3, b=6, *x=&a, *y=&b; 
	cout<<&a<<"  "<<&b<<endl; 
	fun(&a,&b);
	//fun(x,y);
	cout<<"交换后:"<<&a<<"  "<<&b<<endl;
	cout<<a<<","<<b<<endl; 
} 
/*
输出:____________________
答案:3,6

0x22fe2c  0x22fe28
fun=0x22fe28 0x22fe2c
交换后:0x22fe2c  0x22fe28
3,6

--------------------------------
Process exited after 0.3224 seconds with return value 0
请按任意键继续. . .

int *x;
x=&a;

传值
传址 
*/  

#include <iostream> #include <bits/stdc++.h>
using namespace std;
void fun(int a,int b) {	 
	int k; //定义的指针变量k
	k=a; a=b; b=k;
	cout<<"fun a="<<a<<" b="<<b<<endl;
} 
int main( ) {
	int a=3, b=6, *x=&a, *y=&b; //int *x,*y;x=&a,y=&b;
	cout<<" &a="<<&a<<" &b="<<&b<<endl;
	cout<<"x="<<x<<" y="<<y<<endl;
	fun(a,b);
	cout<<" &a="<<&a<<" &b="<<&b<<endl;
	cout<<"x="<<x<<" y="<<y<<endl;
	cout<<a<<","<<b<<endl; 
} 

 &a=0x22fe2c &b=0x22fe28
x=0x22fe2c y=0x22fe28
fun a=6 b=3
 &a=0x22fe2c &b=0x22fe28
x=0x22fe2c y=0x22fe28
3,6

--------------------------------
Process exited after 0.3203 seconds with return value 0
请按任意键继续. . .


#include <iostream> #include <bits/stdc++.h>
using namespace std;
void fun(int *a,int *b) {	 
	int k; //定义的指针变量k
	k=*a; *a=*b; *b=k;
	cout<<"fun a="<<a<<" b="<<b<<endl;
} 
int main( ) {
	int a=3, b=6, *x=&a, *y=&b; //int *x,*y;x=&a,y=&b;
	cout<<" &a="<<&a<<" &b="<<&b<<endl;
	cout<<"x="<<x<<" y="<<y<<endl;
	fun(&a,&b);
	cout<<" &a="<<&a<<" &b="<<&b<<endl;
	cout<<"x="<<x<<" y="<<y<<endl;
	cout<<a<<","<<b<<endl; 
} 

 &a=0x22fe2c &b=0x22fe28
x=0x22fe2c y=0x22fe28
fun a=0x22fe2c b=0x22fe28
 &a=0x22fe2c &b=0x22fe28
x=0x22fe2c y=0x22fe28
6,3

--------------------------------
Process exited after 0.3235 seconds with return value 0
请按任意键继续. . .

#include <iostream> #include <bits/stdc++.h>
using namespace std;
void fun(int &a,int &b) {	 
	int k; 
	k=a; a=b; b=k;
	cout<<"fun a="<<a<<" b="<<b<<endl;
} 
int main( ) {
	int a=3, b=6, *x=&a, *y=&b; //int *x,*y;x=&a,y=&b;
	cout<<" &a="<<&a<<" &b="<<&b<<endl;
	cout<<"x="<<x<<" y="<<y<<endl;
	fun(a,b);
	cout<<" &a="<<&a<<" &b="<<&b<<endl;
	cout<<"x="<<x<<" y="<<y<<endl;
	cout<<a<<","<<b<<endl; 
} 

 &a=0x22fe2c &b=0x22fe28
x=0x22fe2c y=0x22fe28
fun a=6 b=3
 &a=0x22fe2c &b=0x22fe28
x=0x22fe2c y=0x22fe28
6,3

--------------------------------
Process exited after 0.3235 seconds with return value 0
请按任意键继续. . .


NOIP 提高组 初赛 阅读程序写结果

NOIP 提高组 初赛 阅读程序写结果_mrcrack的博客-CSDN博客

NOIP 提高组 初赛 四、阅读程序写结果 习题集(一)NOIP1998-NOIP1999

NOIP 提高组 初赛 四、阅读程序写结果 习题集(一)NOIP1998-NOIP1999_mrcrack的博客-CSDN博客

NOIP 提高组 初赛 四、阅读程序写结果 习题集(二)NOIP2000-NOIP2001

NOIP 提高组 初赛 四、阅读程序写结果 习题集(二)NOIP2000-NOIP2001_noip2001初赛_mrcrack的博客-CSDN博客

NOIP 提高组 初赛 四、阅读程序写结果 习题集(三)NOIP2002-NOIP2003

NOIP 提高组 初赛 四、阅读程序写结果 习题集(三)NOIP2002-NOIP2003_mrcrack的博客-CSDN博客

NOIP 提高组 初赛 四、阅读程序写结果 习题集(四)NOIP2004-NOIP2005

NOIP 提高组 初赛 四、阅读程序写结果 习题集(四)NOIP2004-NOIP2005_c++输入zzyzcccbbbaaa_mrcrack的博客-CSDN博客

NOIP 提高组 初赛 四、阅读程序写结果 习题集(五)NOIP2006-NOIP2007

NOIP 提高组 初赛 四、阅读程序写结果 习题集(五)NOIP2006-NOIP2007_mrcrack的博客-CSDN博客

NOIP 提高组 初赛 四、阅读程序写结果 习题集(六)NOIP2008-NOIP2009

NOIP 提高组 初赛 四、阅读程序写结果 习题集(六)NOIP2008-NOIP2009_mrcrack的博客-CSDN博客

NOIP 提高组 初赛 四、阅读程序写结果 习题集(七)NOIP2010-NOIP2011

NOIP 提高组 初赛 四、阅读程序写结果 习题集(七)NOIP2010-NOIP2011_mrcrack的博客-CSDN博客

NOIP 提高组 初赛 四、阅读程序写结果 习题集(八)NOIP2012-NOIP2013

NOIP 提高组 初赛 四、阅读程序写结果 习题集(八)NOIP2012-NOIP2013_mrcrack的博客-CSDN博客

NOIP 提高组 初赛 四、阅读程序写结果 习题集(九)NOIP2014-NOIP2015

NOIP 提高组 初赛 四、阅读程序写结果 习题集(九)NOIP2014-NOIP2015_mrcrack的博客-CSDN博客


C++信息学奥赛题目归类:初赛普及组阅读程序写结果题

C++信息学奥赛题目归类:初赛普及组阅读程序写结果题_noip初赛 阅读程序写结果c++_qq_41291769的博客-CSDN博客

【初赛】「阅读程序」题答v1.0

【初赛】「阅读程序」题答v1.0_阅读程序题怎么做_小哈里的博客-CSDN博客

【用脚趾头解决NOIP】(2)NOIP2009~NOIP2015年普及组完善程序

【用脚趾头解决NOIP】(2)NOIP2009~NOIP2015年普及组完善程序_noip 完善程序_xiaoyao24256的博客-CSDN博客

【用脚趾头解决NOIP】(1):NOIP2010~NOIP2015普及组问题求解

【用脚趾头解决NOIP】(1):NOIP2010~NOIP2015普及组问题求解_xiaoyao24256的博客-CSDN博客

C++信息学奥赛题目归类:初赛普及组阅读程序写结果题

C++信息学奥赛题目归类:初赛普及组阅读程序写结果题_noip初赛 阅读程序写结果c++_qq_41291769的博客-CSDN博客

FBZ串问题 NOIP1998

https://www.cnblogs.com/myeln/articles/16580782.html

NOIP2017初赛_提高组_阅读程序写结果3.2

NOIP2017初赛_提高组_阅读程序写结果3.2_dllglvzhenfeng的博客-CSDN博客

NOIP初赛_阅读与理解程序

NOIP初赛_阅读与理解程序_边缘坐标的博客-CSDN博客




  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

dllglvzhenfeng

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值