大神来看看,指点一下为什么前面这个通不过!
程序代码:
#include <stdio.h> #include<math.h> typedef struct { int x,y; }POINT2D; int main() { POINT2D p1,p2; char c; scanf("%d/%d",&p1.x,&p1.y); scanf("%d/%d",&p2.x,&p2.y); if(p1.x*p2.y>p1.y*p2.x) { c='>'; } else if(p1.x*p2.y<p1.y*p2.x) { c='<'; } else { c='='; } printf("%d/%d %c %d/%d\n",p1.x,p1.y,c,p2.x,p2.y); return 0; }
程序代码:
#include <stdio.h> #include<math.h> typedef struct { int x,y; }POINT2D; int main() { POINT2D p1,p2; int a; char c; scanf("%d/%d",&p1.x,&p1.y); scanf("%d/%d",&p2.x,&p2.y); a=p1.x*p2.y-p1.y*p2.x; if(a>0) { c='>'; } else if(a<0) { c='<'; } else { c='='; } printf("%d/%d %c %d/%d\n",p1.x,p1.y,c,p2.x,p2.y); return 0; }