1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
|
// CST116_Project1_Schroeder.cpp : This file contains the 'main' function. Program execution begins and ends there.
// This program calculates the volume of a cylinder, given user inputs of: radius, and height
//
// Author: Benjamin Schroeder
// Date: 10/13/2021 7:53pm
// Email: [email protected]
//
/*Documentation of the meetings between Benjamin Schroeder and Federico HernandezJimenez: when, where and what you discussed.
Email: Wed. 10/12/2021 9:00p
Topics discussed:
-What documentation is needed
psuedocode, actual code, errors, etc
-How to submit our documentation
-How to submit our code (working copy, error copy, corrected partner's, etc.)
Email: Fri. 10/15/2021 8:34p
Topics discussed:
-Corresponding by swapping files via email.
-Trouble getting Microsoft computer files to open on Mac
-Problem was resolved via email:
-Visual Studio Code was copied into email and sent to Mac computer.
Then that text copied to a newly created C++ Project on the Mac computer.
-Similarly the .cp file sent from the Mac needed to be opened in NotePad and
that text transeferred to a newly created C++ project on the Microsoft computer.
*/
/*Agile Questions (before I started work on this project):
* What SPECIFIC task will you complete in the next half hour?
* -Think about the problem (volume of a cylinder)
* -Write psuedocode to ease the design process.
* -If time allows, write the code.
* -Also if time allows, make requested errors in code for my project partner
* What do you know about this SPECIFIC task?
* -The equation for volume of a cylinder ...pi*r^2*height
* -<iostream> operators such as cout, cin, etc.
* What DON'T you know about this SPECIFIC task?
* -I don't know how fancy I should get with this program
*/
/*Psuedocode:
* Get Height of cylinder
* Get Radius of cylinder
* Compute Volume = pi*r^2*height
* Output "The volume of this cylinder is: " Volume;
*/
// ACTUAL CODE
#include <iostream>
#include <iomanip>
using namespace std;
int main()
{
// Initialize variables
float height;
float radius;
float pi = 3.141592654;
float volume;
// Ask for dimensions of the cylinder
cout << "******************************************************************";
cout << "\n This program will tell you the volume of a cylinder \n";
cout << "******************************************************************\n";
cout << "\n\tPlease enter the radius of the cylinder (cm): ";
cin >> radius;
cout << "\n\tPlease enter the height of the cylinder (cm): ";
cin >> height;
// Compute the volume of the cylinder
volume = pi * radius * radius * height;
// Output to user
cout << "\n\n\tThe volume of this cylinder is: " << volume << " cm^3\n\n\n ";
return 0;
}
|