当前位置:网站首页>Exercise 9-3 plane vector addition (15 points)
Exercise 9-3 plane vector addition (15 points)
2022-07-04 09:46:00 【skeet follower】
This question requires the preparation of procedures , Calculate the sum of two two-dimensional plane vectors .
Input format :
Type in a line and press “x1 y1 x2 y2” The format gives two two two-dimensional plane vectors v1=(x1,y1) and v2=(x2,y2) Components of .
Output format :
In a row, press (x, y)
Format output and vector , The coordinates are output to one digit after the decimal point ( Note that... Cannot be output −0.0).
sample input :
3.5 -2.7 -13.9 8.7
sample output :
(-10.4, 6.0)
The code is as follows :
#include<stdio.h>
int main()
{
double x1,y1,x2,y2;
scanf("%lf %lf %lf %lf",&x1,&y1,&x2,&y2);
double 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("(%.1f, %.1f)",x,y);
return 0;
}
边栏推荐
- 2022-2028 global probiotics industry research and trend analysis report
- Golang Modules
- Four common methods of copying object attributes (summarize the highest efficiency)
- Write a jison parser from scratch (4/10): detailed explanation of the syntax format of the jison parser generator
- 2022-2028 research and trend analysis report on the global edible essence industry
- C语言指针面试题——第二弹
- Machine learning -- neural network (IV): BP neural network
- System.currentTimeMillis() 和 System.nanoTime() 哪个更快?别用错了!
- 2022-2028 global optical transparency industry research and trend analysis report
- Get the source code in the mask with the help of shims
猜你喜欢
The child container margin top acts on the parent container
Daughter love in lunch box
2022-2028 global visual quality analyzer industry research and trend analysis report
Hands on deep learning (37) -- cyclic neural network
H5 audio tag custom style modification and adding playback control events
Hands on deep learning (38) -- realize RNN from scratch
2022-2028 global intelligent interactive tablet industry research and trend analysis report
Hands on deep learning (33) -- style transfer
el-table单选并隐藏全选框
Hands on deep learning (41) -- Deep recurrent neural network (deep RNN)
随机推荐
DR6018-CP01-wifi6-Qualcomm-IPQ6010-IPQ6018-FAMILY-2T2R-2.5G-ETH-port-CP01-802-11AX-MU-MIMO-OFDMA
Normal vector point cloud rotation
Multilingual Wikipedia website source code development part II
PHP book borrowing management system, with complete functions, supports user foreground management and background management, and supports the latest version of PHP 7 x. Database mysql
In the case of easyUI DataGrid paging, click the small triangle icon in the header to reorder all the data in the database
2022-2028 global intelligent interactive tablet industry research and trend analysis report
2022-2028 global visual quality analyzer industry research and trend analysis report
Basic data types in golang
Deadlock in channel
C language pointer interview question - the second bullet
How do microservices aggregate API documents? This wave of show~
Fatal error in golang: concurrent map writes
Global and Chinese market of bipolar generators 2022-2028: Research Report on technology, participants, trends, market size and share
Mmclassification annotation file generation
Go context 基本介绍
The child container margin top acts on the parent container
SQL replying to comments
Report on the development trend and prospect trend of high purity zinc antimonide market in the world and China Ⓕ 2022 ~ 2027
Hands on deep learning (39) -- gating cycle unit Gru
libmysqlclient. so. 20: cannot open shared object file: No such file or directory