summaryrefslogtreecommitdiff
path: root/4p38.cpp
diff options
context:
space:
mode:
Diffstat (limited to '4p38.cpp')
-rw-r--r--4p38.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/4p38.cpp b/4p38.cpp
new file mode 100644
index 0000000..63c814a
--- /dev/null
+++ b/4p38.cpp
@@ -0,0 +1,18 @@
+#include <iostream>
+
+/*
+ *
+ * 4.38
+ *
+ *
+ */
+
+int main () {
+
+ int i = 3;
+ int j = 10;
+ double slope = static_cast<double>(j / i); // divide i and j as integers and then cast returned value to double
+ // double slope = static_cast<double>(j) / i; I suspect that this version of the expression is what we are actually trying to do
+ std::cout << slope << std::endl;
+ return 0;
+}