请教高手 C语言问题 编程实现求两个数的最大公约数,要有流程图,主要是流程图!!!

如题所述


#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

追答

有代码了,比流程图详细多了

追问

因为老师要求一定要有流程图

追答

关键我不知道你说说的流程图指的是什么?你要不举个流程图的例子我看下?

追问

比如说这种传统流程图

温馨提示:内容为网友见解,仅供参考
无其他回答
相似回答