# New to C , need help on compiling the area of chord. I don't know how to insert it in C

Sigchi4life
Category:
Programming
Price: \$5 USD

Question description

Hi I need guidance in compiling my assignment in C++, I am really new to it.

Assignment states: Write a C++ program to ask for the chord length in inches and print out the percentage of a 14” pizza cut off.  Running your program should look like this:

Pizza diameter is 14”.

Enter chord length in inches: 0

That cuts off 0% of the pizza.

Enter chord length in inches: 14

That cuts off 50% of the pizza.

Enter chord length in inches: 10.17

That cuts off 10% of the pizza.

Use while(cin >> chord) so the program will keep reading and calculating until end

Note: Area of segment is A = r2arcsin(0.5c/r) - 0.5c*sqrt(r2 - c2/4)

What I have so far:

Note: We use "std_lib_facilities" source because we go by the book.

`#include "std_lib_facilities_4.h"int main() {//A = r2arcsin(0.5c / r) - 0.5c*sqrt(r2 - c2 / 4)int diameter = 14, chord;cout << "Pizza diameter is " << diameter << " inches." endl;cout << "Enter chord length in inches: " << endl;cin >> chord;while (cin >> chord)`
And I am not sure how to make an int for that formula in C++., also I am sure i have other mistakes in  my code^ and an explanation will be very helpful.

Any help would be appreciated, thank you!

(Top Tutor) Daniel C.
(997)
School: Cornell University
Studypool has helped 1,244,100 students

1828 tutors are online

Brown University

1271 Tutors

California Institute of Technology

2131 Tutors

Carnegie Mellon University

982 Tutors

Columbia University

1256 Tutors

Dartmouth University

2113 Tutors

Emory University

2279 Tutors

Harvard University

599 Tutors

Massachusetts Institute of Technology

2319 Tutors

New York University

1645 Tutors

Notre Dam University

1911 Tutors

Oklahoma University

2122 Tutors

Pennsylvania State University

932 Tutors

Princeton University

1211 Tutors

Stanford University

983 Tutors

University of California

1282 Tutors

Oxford University

123 Tutors

Yale University

2325 Tutors