summaryrefslogtreecommitdiff
path: root/problem2.cpp
diff options
context:
space:
mode:
authorMichael Abed <michaelabed@gmail.com>2012-02-12 15:09:28 -0500
committerMichael Abed <michaelabed@gmail.com>2012-02-12 15:09:28 -0500
commit85cdcd0e5c89f0c180b63fb0293b9b8f4322d3bb (patch)
tree161c0a39bfad57cfe1339c9a8a03da1aeb3c8666 /problem2.cpp
parentcbca973f699f10d45b725e94ed3f49be9cf1f512 (diff)
downloadec327-lab1-85cdcd0e5c89f0c180b63fb0293b9b8f4322d3bb.tar.gz
ec327-lab1-85cdcd0e5c89f0c180b63fb0293b9b8f4322d3bb.tar.bz2
ec327-lab1-85cdcd0e5c89f0c180b63fb0293b9b8f4322d3bb.zip
move files
Diffstat (limited to 'problem2.cpp')
-rw-r--r--problem2.cpp68
1 files changed, 0 insertions, 68 deletions
diff --git a/problem2.cpp b/problem2.cpp
deleted file mode 100644
index 255b7f8..0000000
--- a/problem2.cpp
+++ /dev/null
@@ -1,68 +0,0 @@
-
-#include <iostream>
-
-using namespace std;
-
-int main()
-{
- double conversion[10] = {0.47317, 2, 0.5, 0.23659, 2.1134, 4.2268};
- unsigned short sel;
- double amount;
-
- cout << "Pints to Liters (enter 0)" << endl;
- cout << "Pints to Cups (enter 1)" << endl;
- cout << "Cups to Pints (enter 2)" << endl;
- cout << "Cups to Liters (enter 3)" << endl;
- cout << "Liters to Pints (enter 4)" << endl;
- cout << "Liters to Cups (enter 5)" << endl;
-
- do {
- cout << "?: ";
- cin >> sel;
- if (sel > 5)
- cout << "Enter a number between 0 and 5" << endl;
- } while (sel > 5);
-
- do {
- switch (sel) {
- case 0: // fallthrough
- case 1:
- cout << "Enter the amount in Pints: ";
- break;
- case 2:
- case 3:
- cout << "Enter the amount in Cups: ";
- break;
- case 4:
- case 5:
- cout << "Enter the amount in Liters: ";
- break;
- }
- cin >> amount;
- if (amount < 0)
- cout << "Enter a positive number" << endl;
- } while (amount < 0);
-
- double result = conversion[sel] * amount;
- switch (sel) {
- case 0:
- cout << amount << " Pints is " << result << " Liters" << endl;
- break;
- case 1:
- cout << amount << " Pints is " << result << " Cups" << endl;
- break;
- case 2:
- cout << amount << " Cups is " << result << " Pints" << endl;
- break;
- case 3:
- cout << amount << " Cups is " << result << " Liters" << endl;
- break;
- case 4:
- cout << amount << " Liters is " << result << " Pints" << endl;
- break;
- case 5:
- cout << amount << " Liters is " << result << " Cups" << endl;
- break;
- }
- return 0;
-}