C programing
Create a structure as shown below to represent a point in the Cartesian plane:
typedef struct {
double x;
double y; }Point;
Create a second structure that models a line segment, which consists of two points, using the structure definition as shown:
typedef struct {
Point start;
Point end; }Line_segment;
Write a void function that has one parameter of type Point and displays that point to the console in the form (x, y).
Write a void function that has one parameter of type Line_segment and displays that line segment to the console in the form P1, P2 (where P1 and P2 will be displayed using the function in step 3 above).
Write a void function that has one parameter of type Point, and displays the position of that point on the Cartesian plane (origin, x-axis, y-axis, Quadrant I, Quadrant II, Quadrant III, or Quadrant IV).
Add the function calculate_length to your program. This function should take one parameter of type Line_segment and return its length.
Steps 7-9 should be done in main:
Declare two Point variables, p1 and p2. Prompt the user to enter coordinates for each. Display each point using the function from step 3.
Create a Line_segment variable and use the user-entered points as start and end. Display the line using the function from step 4.
Call the function from step 4 and output the result with 3 decimal places.
Test your program thoroughly.
11 years ago 10
- power point
- Individual Writing Assignment
- i need someone who can paraphrase 6 short essays
- 10. Describe at least three ORM-D-Other Regulated Materials, and describe how their transportation requirements differ from more hazardous materials.
- FIN 571 Week 2 Individual Assignment Text Problem SetsFIN 571 Week 2 Individual Assignment Text Problem Sets
- FIN 370 Week 4 Individual Assignment Reeds Clothier Case Study and Questions
- Use the University of Phoenix Material: Business Model and Strategic Planning Outline as a guide to complete sections of your capstone...
- Conflict Resolution/Systems Theory Approach
- Terminating Government Contracts Assgn#5
- Company Profiles - New Products