Not logged in. Log in with GitHub. About Websheets.

List of all available Websheets


Viewing cpp/cs102/practice5/computingPie by redekopp@usc.edu. You have unsaved changes. Log in above to create, edit, preview and publish Websheets.
PropertyValue
Description
html markup
shown to student
 
<p>You are invited to a math party. Because no math party is complete without pie, your classmates decided to bring various pies with different radii and slice them at differing increments. 
   Before anyone is allowed to eat the pie, they must calculate the area of the top of the pie slice they have received, given the radius and the angle (in degrees). </p>
<p>
   <strong>Write a program able to calculate the area of your pie so you can eat quickly!</strong></p>
<p>Use the degrees to determine the fraction of the pie you receive, and use the radius to determine the total size of the pie!</p>
Engine
Template / Reference solution
 
#include <iostream>
#include <cmath> //this imports a number of things beyond "pow".  
                 // For example, it imports a constant called "M_PI"...
using namespace std;
   int main()
   {
      double degrees;
      int r;
\[ REDACTED ]\
      
      cin >> degrees >> r;      
\[
REDACTED
]\
      cout <<"area (inches^2) : " << \[ REDACTED ]\ <<endl;
      
      return 0;
   }
C++ test suite
json list of stdin/args tests
e.g. [{"stdin":"hi", "args":["4", "5"]},
{"stdin":"noargs"}]

to just run once with no input use [{}]
 
[
   {"stdin":"360 2", "args":[]},
   {"stdin":"160 50", "args":[]},
   {"stdin":"17 129", "args":[]},
   {"stdin":"0 50000", "args":[]}
]


Optional properties:

Note: problems are open-source by default (see 'Public permissions'). Assumed license for open problems is Creative Commons 4.0 Attribution-ShareAlike unless specified in 'Remarks'.