Write a C++ program that computes the area A of Parallelogram by reading its parameters from a text file "input.bxt". Each line of the file represents the parallelogram name, the side "a", side b" and the angle "c of a Parallelogram, respectively. The program should read each line to compute the area A of each parallelogram. It should also display the total number of computed areas. Your program should implement the following functions:

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question
A Parallelogram is a flat shape with opposite sides parallel and equal in length. The
diagonal of a parallelogram divides it into two congruent triangles. So the total area
of the Parallelogram is always twice the area of one of the triangles formed by the
diagonal as below
A = Vab sin (c)
where, "a" and "b" are the two sides and "c" is the angle in radian.
Write a C++ program that computes the area A of Parallelogram by reading its
parameters from a text file "input.txt". Each line of the file represents the
parallelogram name, the side "a", side "b" and the angle "c" of a Parallelogram,
respectively. The program should read each line to compute the area A of each
parallelogram. It should also display the total number of computed areas. Your
program should implement the following functions:
Area(): This function receives the values of "a", "b", and "c" then computes and
returns the value of area A.
Print(): This function receives the name of Parallelogram and the computed area A
then displays on the output screen.
The input file and sample output are as shown below:
Input File:
Sample Output:
input - Notepad
EASultan\Coursesintroduction to c
File Edit Format View Help
Area of differnt Parallelograms
P1 21 12 e.43
P2 32 43 e.54
P3 54 13 0.79
P4 22 14 e.65
PS 12 33 0.87
6.62
19.07
18.82
P2
P4
PS
10.62
15.21
.......
The total number of computed area is 5
Press any key to continue
Winde Ln 6, ( 100
Transcribed Image Text:A Parallelogram is a flat shape with opposite sides parallel and equal in length. The diagonal of a parallelogram divides it into two congruent triangles. So the total area of the Parallelogram is always twice the area of one of the triangles formed by the diagonal as below A = Vab sin (c) where, "a" and "b" are the two sides and "c" is the angle in radian. Write a C++ program that computes the area A of Parallelogram by reading its parameters from a text file "input.txt". Each line of the file represents the parallelogram name, the side "a", side "b" and the angle "c" of a Parallelogram, respectively. The program should read each line to compute the area A of each parallelogram. It should also display the total number of computed areas. Your program should implement the following functions: Area(): This function receives the values of "a", "b", and "c" then computes and returns the value of area A. Print(): This function receives the name of Parallelogram and the computed area A then displays on the output screen. The input file and sample output are as shown below: Input File: Sample Output: input - Notepad EASultan\Coursesintroduction to c File Edit Format View Help Area of differnt Parallelograms P1 21 12 e.43 P2 32 43 e.54 P3 54 13 0.79 P4 22 14 e.65 PS 12 33 0.87 6.62 19.07 18.82 P2 P4 PS 10.62 15.21 ....... The total number of computed area is 5 Press any key to continue Winde Ln 6, ( 100
Expert Solution
steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY