From 743c47c671347a0ac0f8f64b7117b48c65bab073 Mon Sep 17 00:00:00 2001 From: Oskar Date: Thu, 29 Aug 2024 13:27:45 +0200 Subject: more --- 4p38.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 4p38.cpp (limited to '4p38.cpp') 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 + +/* + * + * 4.38 + * + * + */ + +int main () { + + int i = 3; + int j = 10; + double slope = static_cast(j / i); // divide i and j as integers and then cast returned value to double + // double slope = static_cast(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; +} -- cgit v1.2.3