首页 新闻 赞助 找找看

求两个整分数之和,用c++编译

0
悬赏园豆:5 [已关闭问题] 关闭于 2012-04-18 16:39

原因Loaded 'ntdll.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\kernel32.dll', no matching symbolic information found.

编译器vc6.0

 

 

#include<iostream.h>

int Greatest_Common_Divors(int max, int min)
{
 int temp , i , min1, max1 , max_temp , min_temp;

    temp = max % min ;

 if(temp != 0)
 {
 for(i=2; i< max/2 ; i++)
 {
  max1 = max % i;
  min1 = min % i;

  max_temp = max / i;
  min_temp = min / i;

  if(max1 == min1)
  {
   if((max_temp * min) == (min_temp * max))
   {
    return (max * min_temp);

    break;
   }
  }
 }
}

 else
 {
  return max;
  
 }

}

void
main()

{
 int Greatest_Common_Divors(int max, int min);

 int  add , temp1;

 int a , b, x, y;

 cout << "请你以该种方式输入两个整分数 : a / b --->先输入a , 再输入b\n";

 a = cin.get();
 b = cin.get();
 x = cin.get();
 y = cin.get();

 if(b >= y)
 {
  temp1 = Greatest_Common_Divors(b,y);
 }
 else
 {
  temp1 = Greatest_Common_Divors(y,b);
 }
 add  = a * (temp1 / y) +  x * (temp1 / b);

 cout << add << " / " << temp1 ;

 cout << endl;
}

林胜福的主页 林胜福 | 初学一级 | 园豆:191
提问于:2012-04-18 15:56
< >
分享
所有回答(1)
0

提问题至少说明你的问题在哪里?是出错了还是怎么了?如果是出错了说出你的错误是什么?你的编译平台是什么!!!!!

zsounder | 园豆:2819 (老鸟四级) | 2012-04-18 16:30
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册