aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWyatt <[email protected]>2022-09-29 16:06:18 -0700
committerWyatt <[email protected]>2022-09-29 16:06:18 -0700
commitaf0d02a60cd8a714cbca4526835951f2fb07fb6f (patch)
tree0164273f80b934843ef5228ca5b17e6eb421c005
parentSetting up GitHub Classroom Feedback (diff)
downloadcst116-ch6-debugging-johnson-af0d02a60cd8a714cbca4526835951f2fb07fb6f.tar.xz
cst116-ch6-debugging-johnson-af0d02a60cd8a714cbca4526835951f2fb07fb6f.zip
finishedHEADmain
-rw-r--r--CST116-Ch6-Debugging/CST116-Ch6-Debugging.cpp13
-rw-r--r--CST116-Ch6-Debugging/cst116-ch6-debugging-flowchart.txt11
-rw-r--r--CST116-Ch6-Debugging/cst116-ch6-debugging.txt6
3 files changed, 29 insertions, 1 deletions
diff --git a/CST116-Ch6-Debugging/CST116-Ch6-Debugging.cpp b/CST116-Ch6-Debugging/CST116-Ch6-Debugging.cpp
index 497e2f8..444c7ab 100644
--- a/CST116-Ch6-Debugging/CST116-Ch6-Debugging.cpp
+++ b/CST116-Ch6-Debugging/CST116-Ch6-Debugging.cpp
@@ -1,3 +1,12 @@
+/*
+ Wyatt Johson
+ CST116
+ Chp6 Debugging
+ Ch5 & 6: I/O Streams & Math
+
+*/
+
+
/********************************************************************
* File: CST116-Ch6-Debugging.cpp
*
@@ -13,6 +22,7 @@
* 5) Verify that the value you entered is stored correctly.
* 6) Step over the conversion calculation. What is the value
* in Celsius? Is that the correct value? No.
+* -32
* 7) Remember your order of precedence. Put parentheses around
* Fahrenheit - 32. This needs to be done before the multiplication.
* 8) Stop debugging and recompile.
@@ -24,6 +34,7 @@
* 3) Verify that the value you entered is stored correctly.
* 4) Step over the conversion calculation. What is the value
* in Celsius? Is that the correct value? No.
+* 0
* 5) Look at the division. This is integer division. Therefore,
* 5 / 9 = 0. This is not the result we are looking for.
* 6) Modify the calculation so that it does floating point division.
@@ -51,7 +62,7 @@ int main()
// Breakpoint 1
// Put a breakpoint on the following line
- celcius = 5 / 9 * fahrenheit - 32;
+ celcius = 5.0 / 9.0 * (fahrenheit - 32);
cout << fahrenheit << " degrees F = "
<< celcius << " degrees C" << endl;
diff --git a/CST116-Ch6-Debugging/cst116-ch6-debugging-flowchart.txt b/CST116-Ch6-Debugging/cst116-ch6-debugging-flowchart.txt
new file mode 100644
index 0000000..31a1cae
--- /dev/null
+++ b/CST116-Ch6-Debugging/cst116-ch6-debugging-flowchart.txt
@@ -0,0 +1,11 @@
+Under main()
+create fahrenheit and set to 0
+create celcius and set to 0
+
+set fahrenheit to user input with query "Enter temperature in Fahrenheit: "
+
+set celcius to 5.0 / 9.0 * (fahrenheit - 32)
+
+output { fahrenheit + " degrees F = " + celsius + " degrees C" }
+
+return 0 \ No newline at end of file
diff --git a/CST116-Ch6-Debugging/cst116-ch6-debugging.txt b/CST116-Ch6-Debugging/cst116-ch6-debugging.txt
new file mode 100644
index 0000000..78f454d
--- /dev/null
+++ b/CST116-Ch6-Debugging/cst116-ch6-debugging.txt
@@ -0,0 +1,6 @@
+Enter temperature in Fahrenheit: 212
+212 degrees F = 100 degrees C
+
+C:\Users\wythe\Desktop\Homework\C++\cst166-ch6-debugging-johnson\CST116-Ch6-Debugging\x64\Debug\CST116-Ch6-Debugging.exe (process 26804) exited with code 0.
+To automatically close the console when debugging stops, enable Tools->Options->Debugging->Automatically close the console when debugging stops.
+Press any key to close this window . . . \ No newline at end of file