Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions pretext/Functions/DefiningFunctions.ptx
Original file line number Diff line number Diff line change
Expand Up @@ -78,16 +78,15 @@ int main() {
takes a value <m>n</m> and repeatedly guesses the square root by
making each <m>newguess</m> the <m>oldguess</m> in the subsequent
iteration. The initial guess used here is <m>\frac {n}{2}</m>.
<xref ref="functions_lst-root">Listing 1</xref> shows a function definition that accepts a value
<xref ref="functions_lst-root"/> shows a function definition that accepts a value
<m>n</m> and returns the square root of <m>n</m> after making 20
guesses. Again, the details of Newton's Method are hidden inside the
function definition and the user does not have to know anything about
the implementation to use the function for its intended purpose.
<xref ref="functions_lst-root">Listing 1</xref> also shows the use of the // characters as a comment
<xref ref="functions_lst-root"/>also shows the use of the // characters as a comment
marker. Any characters that follow the // on a line are ignored.</p>

<p xml:id="functions_lst-root" names="lst_root"><term>Listing 1</term>


<listing xml:id="functions_lst-root" name="lst_root">
<program xml:id="newtonsmethod" interactive="activecode" language="cpp">
<input>
// returns the square root of a number as a double
Expand All @@ -113,7 +112,7 @@ int main() {
}
</input>
</program>
</p>
</listing>

<program xml:id="dogwalk" interactive="activecode" language="cpp">
<input>
Expand Down