Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please Hurry I have 60 mins Only!! Complete the following program with appropriate C++ statements. This program stores the information of five (5) lines using

image text in transcribedimage text in transcribedimage text in transcribedPlease Hurry I have 60 mins Only!!

Complete the following program with appropriate C++ statements. This program stores the information of five (5) lines using structures and determines the length of each line. Declare a structure to represent a point with two (2) members of type float; x-coordinate and y- coordinate. Then, create a structure named Line with three (3) members. The members include length of type float, point A and B. Store five (5) input data in an array named In of type Line. The formula for length is Length = V(X8 X.)2 + (Yp - Ya)2 Note: Please write C ++ statements WITHOUT blank spaces unless it is absolutely needed. Example: int num,a,b; 1 2 3 #include #include using namespace std; 4 5 6 7 8 int main() { /*a) Declare structure named Point with 2 members of type float named x and y (3 marks)*/ { 9 10 11 12 13 14 }; /*b) Declare structure named Line with 2 members of type Point named A and B, and one member of 15 16 17 18 19 20 21 { 22 23 24 25 26 }; /*b) Declare structure named Line with 2 members of type Point named A and B, and one member of { }; 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 const int SIZE = 5; /*c) Define array named in of type Line with size 5. Note: use the declared SIZE constant (2 mar 1/Get input data for (int i = 0; i > 41 cout > 42 43 44 45 46 47 48 49 50 51 52 } //Calculate length of line for (int i = 0; i > ; } //Calculate length of line for (int i = 0; i

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

The Millionaire Next Door The Surprising Secrets Of Americas Wealthy

Authors: Thomas J. Stanley, William D. Danko

1st Edition

1589795474, 978-1589795471

Students also viewed these Databases questions