-------{Choi.h}---------
{Choi.cpp}----------
{Choi2.cpp}-----------
~cpp
class GCD{
private:
int x,y;
public:
int big,small,remain;
GCD();
~GCD();
void replace(){
if (x>y) {
big=x;
small=y;
}
else {
big=y;
small=x;
}
}
void mod();
void disp();
};
------~cpp
#include <iostream.h>
#include "Choi.h"
GCD::GCD(){
cout<<"x=";
cin>>x;
cout<<"y=";
cin>>y;
}
GCD::~GCD(){
}
void GCD::mod(){
while (small!=0){
remain=big%small;
big=small;
small=remain;
}
}
void GCD::disp(){
cout<<"x="<<x<<" y="<<y<<endl;
cout<<"GCD="<<big<<endl;
}
---------~cpp
#include "Choi.h"
void main(){
GCD Max;
Max.replace();
Max.mod();
Max.disp();
}
C++ 고 ㅡㅜ
기 .. , ..
기 .. , ..










