#include <stdio.h>
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main()
{
while(1)
{
int a,b,c,k=0;
vector<int> v;
cout<<"请输入第一个数"<<endl;
cin>>a;
cout<<"请输入第二个数"<<endl;
cin>>b;
for (c=1;c<=a*b;c++)
{
if (a%c==0 && b%c==0)
{
printf("%d\n",c);
v.push_back(c);
k++;
}
sort(v.begin(),v.end());
}
printf("两数的最大公约数是:%d\n",v.at(k-1));
}
return 0;
}
追问没流程图啊!!主要是要流程图!!谢谢,发邮箱1563336284@qq.com
追答有代码了,比流程图详细多了
追问因为老师要求一定要有流程图
追答关键我不知道你说说的流程图指的是什么?你要不举个流程图的例子我看下?
追问比如说这种传统流程图