aboutsummaryrefslogtreecommitdiff
path: root/challenge-011/paulo-custodio/cpp/ch-1.cpp
diff options
context:
space:
mode:
authorMohammad S Anwar <Mohammad.Anwar@yahoo.com>2021-06-25 22:10:31 +0100
committerGitHub <noreply@github.com>2021-06-25 22:10:31 +0100
commite0090086774aa250cf0a675c4054c242b48e470a (patch)
treed319b023a91fb2feca2cb880ff73fa6628a60646 /challenge-011/paulo-custodio/cpp/ch-1.cpp
parent0b3e22eaa7919c245aafaefd724b8cfd7fcb612d (diff)
parentb8f9d31801dcc2396202ddd158850baf210553d8 (diff)
downloadperlweeklychallenge-club-e0090086774aa250cf0a675c4054c242b48e470a.tar.gz
perlweeklychallenge-club-e0090086774aa250cf0a675c4054c242b48e470a.tar.bz2
perlweeklychallenge-club-e0090086774aa250cf0a675c4054c242b48e470a.zip
Merge pull request #4343 from pauloscustodio/paulo-custodio
Add solutions to challenge 011
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;
+}