选择结构程序设计(程序2) #include <stdio. h> 井 include< stdlib.h> #include <math. h> maint doublex, y, length print"请输入坐标:Ⅶn"); scanf(%olf,%lf", &x, &y) if(x=0)(y==0) printi("该坐标的高度为:0米n") else
选择结构程序设计(程序2) #include <stdio.h> #include <stdlib.h> #include <math.h> main() { double x,y,length; printf("请输入坐标:\n"); scanf("%lf,%lf",&x,&y); if((x==0)||(y==0)) { printf("该坐标的高度为:0 米\n"); } else {
选择结构程序设计(程序2) if(x>=0)&&(y>=0) length=sqrt(pow((x-2),2)+pow((y-2),2) print("该坐标位于第一象限n");} if(x>0)&&(y<0) length=sqrt(pow((x-2),2)pow((+2), 2) print("该坐标位于第四象限n"); if(X<0)&&(y<O) length=sqrt(pow((x+2), 2)+pow((y+2 ), 2)) print("该坐标位于第三象限n")
选择结构程序设计(程序2) if((x>=0)&&(y>=0)) { length=sqrt(pow((x-2),2)+pow((y-2),2)); printf("该坐标位于第一象限\n"); } if((x>0)&&(y<0)) { length=sqrt(pow((x-2),2)+pow((y+2),2)); printf("该坐标位于第四象限\n"); } if((x<0)&&(y<0)) { length=sqrt(pow((x+2),2)+pow((y+2),2)); printf("该坐标位于第三象限\n"); }