aboutsummaryrefslogtreecommitdiffstats
path: root/ee1301
diff options
context:
space:
mode:
authorRossTheRoss <msattr@gmail.com>2019-02-03 11:57:14 -0600
committerRossTheRoss <msattr@gmail.com>2019-02-03 11:57:14 -0600
commit6dcc5b9a90005df578a2b27dee98618db271dd0a (patch)
treee3dd60a481d94f98c6886548aa4fe00bd3a1208a /ee1301
parentSpacing (diff)
downloadhomework-6dcc5b9a90005df578a2b27dee98618db271dd0a.tar
homework-6dcc5b9a90005df578a2b27dee98618db271dd0a.tar.gz
homework-6dcc5b9a90005df578a2b27dee98618db271dd0a.tar.bz2
homework-6dcc5b9a90005df578a2b27dee98618db271dd0a.tar.lz
homework-6dcc5b9a90005df578a2b27dee98618db271dd0a.tar.xz
homework-6dcc5b9a90005df578a2b27dee98618db271dd0a.tar.zst
homework-6dcc5b9a90005df578a2b27dee98618db271dd0a.zip
Finish problem
Diffstat (limited to 'ee1301')
-rw-r--r--ee1301/wk1/hw1_directory/strap012_1B.cpp25
1 files changed, 16 insertions, 9 deletions
diff --git a/ee1301/wk1/hw1_directory/strap012_1B.cpp b/ee1301/wk1/hw1_directory/strap012_1B.cpp
index 02fd560..f5a00da 100644
--- a/ee1301/wk1/hw1_directory/strap012_1B.cpp
+++ b/ee1301/wk1/hw1_directory/strap012_1B.cpp
@@ -1,5 +1,6 @@
#include <iostream>
#include <string>
+#include <iomanip>
using namespace std;
int main()
@@ -9,17 +10,23 @@ int main()
cin >> option;
if (option == "i") {
-
- cout << "E";
-
+ int r;
+ int g;
+ int b;
+ cout << "Input r, g, b: ";
+ cin >> r >> g >> b;
+ cout << fixed << setprecision(2) << "Float representation: " << r / 255.0 << ", " << g / 255.0 << ", " << b / 255.0;
}else{ if (option == "f") {
-
- cout << "e";
-
+ double r;
+ double g;
+ double b;
+ cout << "Input r, g, b: ";
+ cin >> r >> g >> b;
+ cout << fixed << setprecision(0) << "Integer representation: " << r * 255 << ", " << g * 255 << ", " << b * 255;
}else{
-
- cout << "Invalid option.";
+ cout << "Invalid option." << endl;
+ return 0;
}
}
- cout << endl;
+ cout << endl;
} \ No newline at end of file