diff options
| author | Connor McDowell <[email protected]> | 2024-01-20 12:11:17 -0800 |
|---|---|---|
| committer | Connor McDowell <[email protected]> | 2024-01-20 12:11:17 -0800 |
| commit | 222f3268e6a3aa17e6ca6fc1b24095b575295099 (patch) | |
| tree | 3a1ec40849d93d0f7899ca7d952b3cd5a3e0c58b /Hello World/homework1/homework1.cpp | |
| parent | inclass Exercise 1 final (diff) | |
| download | hello-world-connormcdowell275-develop.tar.xz hello-world-connormcdowell275-develop.zip | |
Diffstat (limited to 'Hello World/homework1/homework1.cpp')
| -rw-r--r-- | Hello World/homework1/homework1.cpp | 74 |
1 files changed, 74 insertions, 0 deletions
diff --git a/Hello World/homework1/homework1.cpp b/Hello World/homework1/homework1.cpp new file mode 100644 index 0000000..a90c622 --- /dev/null +++ b/Hello World/homework1/homework1.cpp @@ -0,0 +1,74 @@ +// Name: Connor McDowell +// Date: 1/20/24 +// Class: CST116 +// Assignment: homework 1 + +#include <iostream> + +using std::cout; +using std::cin; + +int main() +{ + int i = 12; + int j = 5; + int q = 14; + const int k = 1024; + int first = 0; + int second = 0; + int third = 0; + int sum = 0; + int product = 0; + int diff_one = 0; + int diff_two = 0; + int end = 0; + + + cout << "Please input your first number" << std::endl; + std::cin >> first; + + cout << "Please input your second number" << std::endl; + std::cin >> second; + + cout << "Please input your last number" << std::endl; + std::cin >> third; + + sum = first + second + third; + product = first * second * third; + + diff_one = sum - k; + diff_two = product - k; + + cout << "The sum of " << first << " and " << second << " and " << third << " is " << sum << "\n"; + cout << "The product of " << first << " and " << second << " and " << third << " is " << product << "\n"; + cout << "The difference between the sum total, " << sum << " and " << k << " is " << diff_one << "\n"; + cout << "The difference between the product, " << product << " and " << k << " is " << diff_two << "\n"; + + enum color_list { red, blue, green }; + + union MyUnion; + { + int intValue = 2; + double floatValue = 2.3; + char charValue = 2; + }; + + struct myStruct; + { + union MyUnion; + enum color_list; + }; + + typedef struct myStruct my_struct; + /* cout << "enter a number and hit enter to end"; + std::cin >> end; + /* std::cout << "Hello World"<< std::endl; + cout << "Enter a whole number: "; + + std::cin >> i; + + cout << "Your number was: " << i << std::endl; + + */ + return 0; +}
\ No newline at end of file |