aboutsummaryrefslogtreecommitdiff
path: root/challenge-011/paulo-custodio/cpp/ch-1.cpp
diff options
context:
space:
mode:
authordrbaggy <js5@sanger.ac.uk>2021-06-27 20:22:30 +0100
committerdrbaggy <js5@sanger.ac.uk>2021-06-27 20:22:30 +0100
commit287d70fb03bbb2ba51e636cf051775400e94bcb4 (patch)
tree85a39b2a331bbb5b49d17f63ae76796f3999e7ce /challenge-011/paulo-custodio/cpp/ch-1.cpp
parent9beb73e6913f7e462c4aca8719048a7be98e4ad2 (diff)
parent1b3142a75a8db8a886596770514e2d9fa1cd9187 (diff)
downloadperlweeklychallenge-club-287d70fb03bbb2ba51e636cf051775400e94bcb4.tar.gz
perlweeklychallenge-club-287d70fb03bbb2ba51e636cf051775400e94bcb4.tar.bz2
perlweeklychallenge-club-287d70fb03bbb2ba51e636cf051775400e94bcb4.zip
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'challenge-011/paulo-custodio/cpp/ch-1.cpp')
-rw-r--r--challenge-011/paulo-custodio/cpp/ch-1.cpp24
1 files changed, 24 insertions, 0 deletions
diff --git a/challenge-011/paulo-custodio/cpp/ch-1.cpp b/challenge-011/paulo-custodio/cpp/ch-1.cpp
new file mode 100644
index 0000000000..e3096ba9da
--- /dev/null
+++ b/challenge-011/paulo-custodio/cpp/ch-1.cpp
@@ -0,0 +1,24 @@
+/*
+Challenge 011
+
+Challenge #1
+Write a script that computes the equal point in the Fahrenheit and Celsius
+scales, knowing that the freezing point of water is 32oF and 0oC, and that
+the boiling point of water is 212oF and 100oC. This challenge was proposed
+by Laurent Rosenfeld.
+
+F = (C * 9/5) + 32
+F = C = x
+=> x = (x * 9/5) + 32
+<=> x * (1 - 9/5) = 32
+<=> x = 32 / (1 - 9/5)
+*/
+
+#include <iostream>
+#include <iomanip>
+using namespace std;
+
+int main() {
+ cout << fixed << setprecision(1)
+ << 32.0 / (1.0 - 9.0/5.0) << endl;
+}