Server IP : 172.16.15.8 / Your IP : 3.138.122.90 Web Server : Apache System : Linux zeus.vwu.edu 4.18.0-553.27.1.el8_10.x86_64 #1 SMP Wed Nov 6 14:29:02 UTC 2024 x86_64 User : apache ( 48) PHP Version : 7.2.24 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON Directory (0705) : /home/mpcollins/ |
[ Home ] | [ C0mmand ] | [ Upload File ] |
---|
// File Name: hw2.cpp // Author: Michael Collins // Instructor: Dr. John Wang // Due Date: Wed. Sept. 12, 2007 // Compilation: g++ hw2.cpp -o hw2.out // Execution: ./hw2.out // Goal: This program will print a circles circumference // and area after the user inputs the radius #include <iostream> using namespace std; int main() { // 1. declare variable float radius, circumference, area; string line = "---------------------------------------------"; // 2. input - prompt a message cout << line; cout << "\n\nPlease input the radius of the circle: "; cin >> radius; cout << "\n"; // 3. computing area = radius * radius * 3.14; circumference = 2 * 3.14 * radius; // 4. output cout << "The area of circle is: " << area << "\n\n"; cout << "The circumference of the circle is: " << circumference << "\n\n"; cout << line << "\n\n"; return 0; }