PTA-平面向量加法(C语言)
#include <stdio.h>
int main(){
double x1,x2,y1,y2,x,y;
scanf("%lf %lf %lf %lf",&x1,&y1,&x2,&y2);
x=x1+x2;y=y1+y2;
if(x>-0.05&&x<0){
x=0.0;
}
if(y>-0.05&&y<0){
y=0.0;
}
printf("(%1.1f, %1.1f)",x,y);
return 0;
}
#include <stdio.h>
int main(){
double x1,x2,y1,y2,x,y;
scanf("%lf %lf %lf %lf",&x1,&y1,&x2,&y2);
x=x1+x2;y=y1+y2;
if(x>-0.05&&x<0){
x=0.0;
}
if(y>-0.05&&y<0){
y=0.0;
}
printf("(%1.1f, %1.1f)",x,y);
return 0;
}