diff options
Diffstat (limited to 'ee1301/wk1/lab1')
-rw-r--r-- | ee1301/wk1/lab1/strap012_lab1_c_2.cpp | 19 | ||||
-rw-r--r-- | ee1301/wk1/lab1/strap012_lab1_c_3.cpp | 0 | ||||
-rw-r--r-- | ee1301/wk1/lab1/strap012_lab1_s_2.cpp | 14 | ||||
-rw-r--r-- | ee1301/wk1/lab1/strap012_lab1_w_1.cpp | 9 |
4 files changed, 42 insertions, 0 deletions
diff --git a/ee1301/wk1/lab1/strap012_lab1_c_2.cpp b/ee1301/wk1/lab1/strap012_lab1_c_2.cpp index e69de29..941d8de 100644 --- a/ee1301/wk1/lab1/strap012_lab1_c_2.cpp +++ b/ee1301/wk1/lab1/strap012_lab1_c_2.cpp @@ -0,0 +1,19 @@ +#include <iostream> +using namespace std; + +int main() +{ + string first; + string middle; + string last = " "; + cout << "What is your full name?" << endl; + cin >> first >> middle >> last; + if (last == " ") + { + cout << middle << ", " << first; + } + else + { + cout << last << ", " << first << " " << middle << endl; + } +} diff --git a/ee1301/wk1/lab1/strap012_lab1_c_3.cpp b/ee1301/wk1/lab1/strap012_lab1_c_3.cpp deleted file mode 100644 index e69de29..0000000 --- a/ee1301/wk1/lab1/strap012_lab1_c_3.cpp +++ /dev/null diff --git a/ee1301/wk1/lab1/strap012_lab1_s_2.cpp b/ee1301/wk1/lab1/strap012_lab1_s_2.cpp index e69de29..4b63f5c 100644 --- a/ee1301/wk1/lab1/strap012_lab1_s_2.cpp +++ b/ee1301/wk1/lab1/strap012_lab1_s_2.cpp @@ -0,0 +1,14 @@ +#include <iostream> +using namespace std; + +int main() +{ + double tf; + cout << "Enter temperature in degrees Celsius: "; + cin >> tf; + char c = 'F'; + double tc = tf; + char f = 'C'; + cout << tc << " degrees " << f << " = " << tf * (9/5.0) + 32 <<" degrees " << c << endl; +} + diff --git a/ee1301/wk1/lab1/strap012_lab1_w_1.cpp b/ee1301/wk1/lab1/strap012_lab1_w_1.cpp index e69de29..9f70b87 100644 --- a/ee1301/wk1/lab1/strap012_lab1_w_1.cpp +++ b/ee1301/wk1/lab1/strap012_lab1_w_1.cpp @@ -0,0 +1,9 @@ +#include <iostream> +#include <string> +using namespace std; + +int main() +{ + int x = 5; + cout << x << "! = " << x * (x / x + x / x + x / x + x / x) * (x / x + x / x + x / x) * (x / x + x / x) * (x / x) << endl; +}
\ No newline at end of file |