弱弱地问一句,代码是这么写的吗??
#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;
}