diff options
author | Michael Abed <michaelabed@gmail.com> | 2012-02-12 15:20:36 -0500 |
---|---|---|
committer | Michael Abed <michaelabed@gmail.com> | 2012-02-12 15:20:36 -0500 |
commit | 986e3aa56c96097bb6993e48859ea6540e9ad7cc (patch) | |
tree | 9d406e9a2a90e3af396c31603c7fa38294628451 /Q1.cpp | |
parent | 0e81d872502c86f061cf9003b77ac5b0abdabcba (diff) | |
download | ec327-lab1-986e3aa56c96097bb6993e48859ea6540e9ad7cc.tar.gz ec327-lab1-986e3aa56c96097bb6993e48859ea6540e9ad7cc.tar.bz2 ec327-lab1-986e3aa56c96097bb6993e48859ea6540e9ad7cc.zip |
Comment things and add headings
Diffstat (limited to 'Q1.cpp')
-rw-r--r-- | Q1.cpp | 16 |
1 files changed, 12 insertions, 4 deletions
@@ -1,3 +1,10 @@ +/* + * Michael Abed <mgabed@bu.edu> + * + * Lab 1 Problem 1 + * + * Compare area of 2 triangles + */ #include <iostream> @@ -7,14 +14,15 @@ int main() double t1b, t1h, t2b, t2h; // base and height of triangle 1 and 2 cout << "Enter the information for the first triangle:" << endl; - do { + // make sure valid things are entered + do { // triangle 1 base cout << "Base: "; cin >> t1b; if (t1b - (int)t1b != 0 || t1b <= 0) cout << "Please enter a positive integer" << endl; } while (t1b <= 0 || t1b - (int)t1b != 0); - do { + do { // triangle 1 height cout << "Height: "; cin >> t1h; if (t1h - (int)t1h != 0 || t1h <= 0) @@ -23,14 +31,14 @@ int main() cout << "Second Triangle:" << endl; - do { + do { // triangle 2 base cout << "Base: "; cin >> t2b; if (t2b - (int)t2b != 0 || t2b <= 0) cout << "Please enter a positive integer" << endl; } while (t2b <= 0 || t2b - (int)t2b != 0); - do { + do { // triangle 2 height cout << "Height: "; cin >> t2h; if (t2h - (int)t2h != 0 || t2h <= 0) |