diff options
| -rw-r--r-- | CST116F2021-Proj1/CST116F2021-Proj1.cpp | 74 |
1 files changed, 70 insertions, 4 deletions
diff --git a/CST116F2021-Proj1/CST116F2021-Proj1.cpp b/CST116F2021-Proj1/CST116F2021-Proj1.cpp index acd7dc5..4b04deb 100644 --- a/CST116F2021-Proj1/CST116F2021-Proj1.cpp +++ b/CST116F2021-Proj1/CST116F2021-Proj1.cpp @@ -1,7 +1,73 @@ #include <iostream> using namespace std; -int main() -{ - cout << "Project 1 Working"; -}
\ No newline at end of file + +//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); +//}
\ No newline at end of file |