#include <iostream>
#include <string>
using namespace std;
void Swap(int& a,int& b ){
int temp;
temp=a;
a=b;
b=temp;
}
void Swap(double& a,double& b ){
double temp;
temp=a;
a=b;
b=temp;
}
void Swap(string& a,string& b ){
string temp;
temp=a;
a=b;
b=temp;
}
int main() {
int a, b;
double s, t;
string mr, ms;
cin >> a >> b;
cin >> s >> t;
cin >> mr >> ms;
Swap(a, b);
Swap(s, t);
Swap(mr, ms);
cout << a << " " << b << " ";
cout << s << " " << t << " ";
cout << mr << " " << ms;
return 0;
}
Thanks
Happy programming !
#include <string>
using namespace std;
void Swap(int& a,int& b ){
int temp;
temp=a;
a=b;
b=temp;
}
void Swap(double& a,double& b ){
double temp;
temp=a;
a=b;
b=temp;
}
void Swap(string& a,string& b ){
string temp;
temp=a;
a=b;
b=temp;
}
int main() {
int a, b;
double s, t;
string mr, ms;
cin >> a >> b;
cin >> s >> t;
cin >> mr >> ms;
Swap(a, b);
Swap(s, t);
Swap(mr, ms);
cout << a << " " << b << " ";
cout << s << " " << t << " ";
cout << mr << " " << ms;
return 0;
}
Thanks
Happy programming !
No comments:
Post a Comment