-->
当前位置:首页 > 题库

PROGRAMMING:2017final function template

Luz5年前 (2021-05-10)题库476
The class point of data spacing problem (function template) has three data members: X, y and Z, representing x, y and Z coordinates respectively, and has several constructors and a member function overloaded with (minus sign, calculating the distance between two points). It is required to design a function template,
template < class T> double dist(T a, T b)
For int, float, point or other types of data, return the spacing.
###Input format:
Each line has an operation. The first number of each line is the element type. 1 is the integer element, 2 is the floating-point element, and 3 is the point type. If it is an integer element, then enter two integer data. If it is a floating-point element, then enter two floating-point data. If it is a point element, enter two point data (x1 Y1 Z1 x2 Y2 Z2). When entering 0, it marks the end of the input.
###Output format:
For each input, output a spacing value per line.
###Input example:
```in
1 2 5
3 2 4 7 5 9 7
2 2.2 9.9
0
```
###Output example:
```out
three
five point eight three zero nine five
seven point seven
```






answer:If there is no answer, please comment