Website Summary Files Commits Branches @commit @diff @stats
path: root / Week07 / Exercise04.cpp
diff options
context:
space:
mode:
1 files changed, 19 insertions, 0 deletions
-rw-r--r--Week07/Exercise04.cpp19
diff --git a/Week07/Exercise04.cpp b/Week07/Exercise04.cpp
new file mode 100644
index 0000000..931931d
--- /dev/null
+++ b/Week07/Exercise04.cpp
@@ -0,0 +1,19 @@
+#include <iostream>
+
+void calc(float number, double &half, int* integer) {
+ half = number / 2.0;
+ *integer = (int)number;
+}
+
+int main() {
+ float input;
+ std::cin >> input;
+
+ double a;
+ int b;
+ calc(input, a, &b);
+
+ std::cout << a << ' ' << b << std::endl;
+
+ return 0;
+}