U E D R , A S I H C RSS

최대공약수/남도연

-------{Choi.h}---------
~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();
		
};
------{Choi.cpp}----------
~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;
}
---------{Choi2.cpp}-----------
~cpp 
#include "Choi.h"

void main(){
	GCD Max;
	Max.replace();
	Max.mod();
	Max.disp();
}

한 C++ ㅡㅜ
.. , ..

~ 클 , ..
?
, .ㅎ
.. .. !~ ㅎㅎ
히 하 ~ 힘~ 팅~! -
Valid XHTML 1.0! Valid CSS! powered by MoniWiki
last modified 2021-02-07 05:31:16
Processing time 0.0186 sec