// CS.h
// --------------------------------
class CS{
public:
void swap(int *x, int *y)
{
int temp;
temp = *x;
*x=*y;
*y=temp;
}
};
// cs.cpp
// ---------------------------------
#include <stdio.h>
#include "CS.h"
int main()
{
int a=3, b=5;
CS cs1;
cs1.swap(&a,&b);
printf("a=%d, b=%d\n", a, b);
return 0;
}
댓글 없음:
댓글 쓰기