Challenge: Calculate Distance Between Two Points
Explore how to use Rust structs to calculate the distance between two points. Understand how to work with instances of structs, manage data with tuples, and apply mathematical formulas within Rust programming.
We'll cover the following...
We'll cover the following...
Problem Statement
-
A struct
Pointis given which has two items,xandy. -
The function
testis given which has two instances of points initialized with some value ofxandy. -
The task is to calculate the distance between the two points.
The distance between two points is: ...