![]() |
#2
forclwy2009-09-14 18:29
|

#include<iostream>
void yuns();
void yu();
int main()
{
using namespace std;
int a,b,e,f,t;
float c,d;
cout<<"请输入两个数:";
cin>>a>>b;
if(a>=b)
a=a,b=b;
else
t=a;
a=b;
b=t;
e=0;
yuns();
system("pause");
return 0;
}
void yuns()
{
int a,b,e,f,t;
float c,d;
f=b-e;
c=a/f;
d=b-f;
yu();
}
void yu()
{
using namespace std;
int a,b,e,f,t;
float c,d;
if(c-(int)c==0)
{
if(d-(int)d==0)
cout<<"\n最大公约数为:"<<f;
else
e++;
yuns();
}
else
e++;
yuns();
}
结果是:
只有本站会员才能查看附件,请 登录
[ 本帖最后由 lub1990 于 2009-9-14 13:47 编辑 ]