summaryrefslogtreecommitdiff
path: root/CST116F2021-Proj1/CST116F2021-Proj1.cpp
blob: 4b04deb87410041d7dc5cc2d6f5026acebc11fa0 (plain) (blame)
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
#include <iostream>
using namespace std;


//MY functioning code
//int main()
//{
//	float radius;
//	float height;

//	cout << "Enter cylinder radius " << endl;
//	cin >> radius;
//	cout << "Enter cylinder height " << endl;
//	cin >> height;

//	float volume = (3.14) * (radius * radius) * (height);

//	cout << "Your cylinder's volume is " << volume;

//	return 0;
//}

//MY code with 1 syntax error and 1 logic error
//int main()
//{
//	float radius;
//	float height;

//	cout << "Enter cylinder radius" << endl;
//	cin >> radius;
//	cout << "Enter cylinder height"; << endl;
//	cin >> height;

//	bool volume = (3.14) * (radius * radius) * (height);

//	cout << "Your cylinder's volume is " << volume;

//	return 0;
//}

//Partner's code with 1 syntax error and 1 logic error
//int main() {
//
//    do
//    {
//        float cylinderR = 0;
//        float cylinderH = 0;
//        float pi = 3.1415;
//        std::cout << "What is the height of your cylinder?\n";
//        std::cin >> cylinderH;
//        std::cout << "What is the Radius of your cylinder?\n";
//        std::cin >> cylinderR;
//        float cylinderTotal = pi * cylinderH * cylinderR + cylinderR;
//        std::cout << "The volume of your cylinder is " << cylinderTotal << ".\n"
//    } while (true);
//}

//Partner's corrected code
//int main() {

//    do
//    {
//        float cylinderR = 0;
//        float cylinderH = 0;
//        float pi = 3.1415;
//        std::cout << "What is the height of your cylinder?\n";
//        std::cin >> cylinderH;
//        std::cout << "What is the Radius of your cylinder?\n";
//        std::cin >> cylinderR;
//        float cylinderTotal = pi * cylinderH * (cylinderR * cylinderR);
//        std::cout << "The volume of your cylinder is " << cylinderTotal << ".\n";
//    } while (true);
//}