7-65 平面向量加法

#include<stdio.h>
int main (){
	double x1,x2,y1,y2;
	scanf("%lf %lf %lf %lf",&x1,&y1,&x2,&y2);
	double x3=x1+x2;
	double y3=y1+y2;
		if(x3<0&&x3>-0.05){
			if(y3>=0||y3<=-0.05)
			printf("(0.0, %.1lf)",y3);
			else
			printf("(0.0, 0.0)");
		}
		else if(y3<0&&y3>-0.05){
			printf("(%.1lf, 0.0)",x3);
		}
		else 
		printf("(%.1lf, %.1lf)",x3,y3);
	
	return 0;
}

猜你喜欢

转载自blog.csdn.net/michaelliu6/article/details/78634876
今日推荐