- you must try to solve the problem first then, read my Solution :)
- Create a struct to store information about a student, such as
name
,age
, andGPA
. - Write a function that accepts an array of students and prints the student with the highest GPA.
- The Solution
- Define a
Point
struct withx
andy
coordinates. - Write a function to calculate the distance between two points using the distance formula:
- Distance Formula:
distance = sqrt((x2 - x1)^2 + (y2 - y1)^2)
- Distance Formula:
- The Solution
- Define a
Rectangle
struct that holds the coordinates of two opposite corners of a rectangle. - Write a function to calculate the area of the rectangle based on the corner points.
Area = |(x2 - x1) * (y2 - y1)|
- The Solution