什么玩意
  • 板块灌水区
  • 楼主lizesheng520
  • 当前回复5
  • 已保存回复5
  • 发布时间2024/9/7 09:04
  • 上次更新2024/9/7 11:48:00
查看原帖
什么玩意
1207843
lizesheng520楼主2024/9/7 09:04

弱弱地问一句,代码是这么写的吗??

#include <iostream>

bool swapp(int* a,int* b){
	int c,temp[2];
	temp[0]=*a;temp[1]=*b;c=*a;*a=*b;*b=c;
	return temp[0]==*b&&temp[1]==*a;
}
bool swapp(double* a,double* b){
	double c,temp[2];
	temp[0]=*a;temp[1]=*b;c=*a;*a=*b;*b=c;
	return temp[0]==*b&&temp[1]==*a;
}
bool swapp(long long* a,long long* b){
	long long c,temp[2];
	temp[0]=*a;temp[1]=*b;c=*a;*a=*b;*b=c;
	return temp[0]==*b&&temp[1]==*a;
}
bool swapp(char* a,char* b){
	char c,temp[2];
	temp[0]=*a;temp[1]=*b;c=*a;*a=*b;*b=c;
	return temp[0]==*b&&temp[1]==*a;
}
int main(int argc, char** argv) {
	using namespace std;
	int a,b;double c,d;long long e,f;char g,h;
	cin>>a>>b>>c>>d>>e>>f>>g>>h;
	cout<<swapp(&a,&b)<<" "<<swapp(&c,&d)<<" "<<swapp(&e,&f)<<" "<<swapp(&g,&h)<<" "<<endl;
	cout<<a<<" "<<b<<" "<<c<<" "<<d<<" "<<e<<" "<<f<<" "<<g<<" "<<h;
	return 0;
}
2024/9/7 09:04
加载中...