关于c++编程的小问题
在c++中怎样把确定分数是不是最简的,怎样把分数化简?#include "stdafx.h" #include <iostream.h> int printstar(int num1,int num2) { int mid,a,b; int yue=1; if (num1<num2) {mid=num2; num2=num1; num1=mid; } a=num1; b=num2; while(yue!=0) { if (a%b==0) { yue=b; break; } else { yue=a%b; a=b; b=yue; } } cout<<"公约数是:"; cout<<yue<<endl; if(yue!=1) return 1; else return 0; } void main() { int num,num0; cout<<"分母:"<<endl; cin>>num; cout<<"分子:"<<endl; cin>>num0; if(printstar(num,num0)==1) cout<<"不是最简"<<endl; else cout<<"是最简"<<endl; }你是这个意思吧?判断分数是否最简?