65,186
社区成员




#include<iostream>
using namespace std;
struct point
{
int x;
int y;
point(int x,int y)
{
this->x=x;
this->y=y;
}
};
void sort(point* a,point *b)
{
a->x=6;
b->x=8;
}
int main()
{
point a(3,5);
point b(4,6);
cout<<a.x<<" "<<a.y<<endl;
cout<<b.x<<" "<<b.y<<endl;
sort(&a,&b);
cout<<a.x<<" "<<a.y<<endl;
cout<<b.x<<" "<<b.y<<endl;
return 0;
}
#include <iostream>
using namespace std;
typedef struct _Point
{
int x;
int y;
}Point;
void swap(Point *a, Point *b)
{
int x = a->x;
a->x = b->x;
b->x = x;
}
void main()
{
Point a = {1, 2};
Point b = {2, 3};
swap(&a, &b);
cout << a.x << endl;
cout << b.x << endl;
}