Solution Review: Calculate the Area of the Sphere
Let's go over the solution review in this lesson.
We'll cover the following...
Solution #
Press + to interact
#include <iostream>using namespace std;int main() {// Initialize a variable rdouble r = 10.1;// Prints value of rcout << "r = " << r << endl;// Initialize a constant piconst double pi = 3.14;// Declares a variable areadouble area;// Find the area using a given formulaarea = 4*pi*r*r;// Prints value of areacout << "area = " << area;}
Explanation
...