Documentation for 8b1eab204b

This commit is contained in:
realstealthninja
2024-11-04 12:43:05 +00:00
parent 4fb6e622e9
commit a7bccf7d01
6732 changed files with 153919 additions and 365711 deletions

View File

@@ -1,3 +1,4 @@
<!-- HTML header for doxygen 1.12.0-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US">
<head>
@@ -5,10 +6,15 @@
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
<meta name="generator" content="Doxygen 1.12.0"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>Algorithms_in_C++: others/postfix_evaluation.cpp File Reference</title>
<title>TheAlgorithms/C++: others/postfix_evaluation.cpp File Reference</title>
<link rel="icon" href="../../favicon.svg" type="image/x-icon" />
<link href="../../tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="../../jquery.js"></script>
<script type="text/javascript" src="../../dynsections.js"></script>
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/@xpack-3rd-party/doxygen-awesome-css@2.2.0-1/doxygen-awesome-darkmode-toggle.js"></script>
<script type="text/javascript">
DoxygenAwesomeDarkModeToggle.init()
</script>
<script type="text/javascript" src="../../clipboard.js"></script>
<link href="../../navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="../../navtreedata.js"></script>
@@ -18,14 +24,24 @@
<link href="../../search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="../../search/searchdata.js"></script>
<script type="text/javascript" src="../../search/search.js"></script>
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
extensions: ["tex2jax.js", "TeX/AMSmath.js", "TeX/AMSsymbols.js"],
jax: ["input/TeX","output/HTML-CSS"],
});
<script type="text/javascript">
window.MathJax = {
options: {
ignoreHtmlClass: 'tex2jax_ignore',
processHtmlClass: 'tex2jax_process'
},
loader: {
load: ['[tex]/ams']
},
tex: {
macros: {},
packages: ['base','configmacros','ams']
}
};
</script>
<script type="text/javascript" async="async" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.7/MathJax.js?config=TeX-MML-AM_CHTML/MathJax.js"></script>
<script type="text/javascript" id="MathJax-script" async="async" src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-chtml.js"></script>
<link href="../../doxygen.css" rel="stylesheet" type="text/css" />
<link href="../../doxygen-awesome.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
@@ -33,10 +49,11 @@ MathJax.Hub.Config({
<table cellspacing="0" cellpadding="0">
<tbody>
<tr id="projectrow">
<td id="projectlogo"><img alt="Logo" src="../../project_logo.png"/></td>
<td id="projectalign">
<div id="projectname">Algorithms_in_C++<span id="projectnumber">&#160;1.0.0</span>
<div id="projectname">TheAlgorithms/C++<span id="projectnumber">&#160;1.0.0</span>
</div>
<div id="projectbrief">Set of algorithms implemented in C++.</div>
<div id="projectbrief">All the algorithms implemented in C++</div>
</td>
</tr>
</tbody>
@@ -124,7 +141,9 @@ Include dependency graph for postfix_evaluation.cpp:</div>
<div class="dyncontent">
<div class="center"><iframe scrolling="no" frameborder="0" src="../../d5/dc8/postfix__evaluation_8cpp__incl.svg" width="422" height="111"><p><b>This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.</b></p></iframe></div>
</div>
</div><table class="memberdecls">
</div>
<p><a href="../../d7/d75/postfix__evaluation_8cpp_source.html">Go to the source code of this file.</a></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="nested-classes" name="nested-classes"></a>
Classes</h2></td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">class &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d5/d8a/classothers_1_1postfix__expression_1_1_stack.html">others::postfix_expression::Stack</a></td></tr>
@@ -148,14 +167,14 @@ Functions</h2></td></tr>
<tr class="memitem:a421baa2002a64bc0bfc3e1b64800d734" id="r_a421baa2002a64bc0bfc3e1b64800d734"><td class="memItemLeft" align="right" valign="top">float&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#a421baa2002a64bc0bfc3e1b64800d734">others::postfix_expression::pop</a> (<a class="el" href="../../d5/d8a/classothers_1_1postfix__expression_1_1_stack.html">Stack</a> *<a class="el" href="../../d1/dc2/classstack.html">stack</a>)</td></tr>
<tr class="memdesc:a421baa2002a64bc0bfc3e1b64800d734"><td class="mdescLeft">&#160;</td><td class="mdescRight">Popping operand, also called the number from the stack. <br /></td></tr>
<tr class="separator:a421baa2002a64bc0bfc3e1b64800d734"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a4c27f949c9d6659be9f5bd2ccbe1360a" id="r_a4c27f949c9d6659be9f5bd2ccbe1360a"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#a4c27f949c9d6659be9f5bd2ccbe1360a">others::postfix_expression::is_number</a> (const <a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/string/basic_string.html">std::string</a> &amp;s)</td></tr>
<tr class="memitem:a4c27f949c9d6659be9f5bd2ccbe1360a" id="r_a4c27f949c9d6659be9f5bd2ccbe1360a"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#a4c27f949c9d6659be9f5bd2ccbe1360a">others::postfix_expression::is_number</a> (const std::string &amp;s)</td></tr>
<tr class="memdesc:a4c27f949c9d6659be9f5bd2ccbe1360a"><td class="mdescLeft">&#160;</td><td class="mdescRight">Checks if scanned string is a number. <br /></td></tr>
<tr class="separator:a4c27f949c9d6659be9f5bd2ccbe1360a"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a59fd597e0ea394abe027ced4d2ea3338" id="r_a59fd597e0ea394abe027ced4d2ea3338"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#a59fd597e0ea394abe027ced4d2ea3338">others::postfix_expression::evaluate</a> (float a, float b, const <a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/string/basic_string.html">std::string</a> &amp;operation, <a class="el" href="../../d5/d8a/classothers_1_1postfix__expression_1_1_stack.html">Stack</a> *<a class="el" href="../../d1/dc2/classstack.html">stack</a>)</td></tr>
<tr class="memitem:a59fd597e0ea394abe027ced4d2ea3338" id="r_a59fd597e0ea394abe027ced4d2ea3338"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#a59fd597e0ea394abe027ced4d2ea3338">others::postfix_expression::evaluate</a> (float a, float b, const std::string &amp;operation, <a class="el" href="../../d5/d8a/classothers_1_1postfix__expression_1_1_stack.html">Stack</a> *<a class="el" href="../../d1/dc2/classstack.html">stack</a>)</td></tr>
<tr class="memdesc:a59fd597e0ea394abe027ced4d2ea3338"><td class="mdescLeft">&#160;</td><td class="mdescRight">Evaluate answer using given last two operands from and operation. <br /></td></tr>
<tr class="separator:a59fd597e0ea394abe027ced4d2ea3338"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ae38bd3a177a6d61da3859a281233bbe1" id="r_ae38bd3a177a6d61da3859a281233bbe1"><td class="memTemplParams" colspan="2">template&lt;<a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/types/size_t.html">std::size_t</a> N&gt; </td></tr>
<tr class="memitem:ae38bd3a177a6d61da3859a281233bbe1"><td class="memTemplItemLeft" align="right" valign="top">float&#160;</td><td class="memTemplItemRight" valign="bottom"><a class="el" href="#ae38bd3a177a6d61da3859a281233bbe1">others::postfix_expression::postfix_evaluation</a> (<a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/array.html">std::array</a>&lt; <a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/string/basic_string.html">std::string</a>, N &gt; input)</td></tr>
<tr class="memitem:ae38bd3a177a6d61da3859a281233bbe1" id="r_ae38bd3a177a6d61da3859a281233bbe1"><td class="memTemplParams" colspan="2">template&lt;std::size_t N&gt; </td></tr>
<tr class="memitem:ae38bd3a177a6d61da3859a281233bbe1"><td class="memTemplItemLeft" align="right" valign="top">float&#160;</td><td class="memTemplItemRight" valign="bottom"><a class="el" href="#ae38bd3a177a6d61da3859a281233bbe1">others::postfix_expression::postfix_evaluation</a> (std::array&lt; std::string, N &gt; input)</td></tr>
<tr class="memdesc:ae38bd3a177a6d61da3859a281233bbe1"><td class="mdescLeft">&#160;</td><td class="mdescRight">Postfix Evaluation algorithm to compute the value from given input array. <br /></td></tr>
<tr class="separator:ae38bd3a177a6d61da3859a281233bbe1"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a6a8eeb7d346d5cd6335d9780fb7c0f15" id="r_a6a8eeb7d346d5cd6335d9780fb7c0f15"><td class="memItemLeft" align="right" valign="top">static void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#a6a8eeb7d346d5cd6335d9780fb7c0f15">test_function_1</a> ()</td></tr>
@@ -172,6 +191,8 @@ Functions</h2></td></tr>
<div class="textblock"><p>Evaluation of <a href="https://en.wikipedia.org/wiki/Reverse_Polish_notation" target="_blank">Postfix Expression</a> </p>
<dl class="section author"><dt>Author</dt><dd><a href="https://github.com/Darshana-Sarma" target="_blank">Darshana Sarma</a></dd></dl>
<p>Create a stack to store operands (or values). Scan the given expression and do following for every scanned element. If the element is a number, push it into the stack If the element is a operator, pop operands for the operator from stack. Evaluate the operator and push the result back to the stack When the expression is ended, the number in the stack is the final answer </p>
<p class="definition">Definition in file <a class="el" href="../../d7/d75/postfix__evaluation_8cpp_source.html">postfix_evaluation.cpp</a>.</p>
</div><h2 class="groupheader">Function Documentation</h2>
<a id="a59fd597e0ea394abe027ced4d2ea3338" name="a59fd597e0ea394abe027ced4d2ea3338"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a59fd597e0ea394abe027ced4d2ea3338">&#9670;&#160;</a></span>evaluate()</h2>
@@ -192,7 +213,7 @@ Functions</h2></td></tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const <a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/string/basic_string.html">std::string</a> &amp;</td> <td class="paramname"><span class="paramname"><em>operation</em></span>, </td>
<td class="paramtype">const std::string &amp;</td> <td class="paramname"><span class="paramname"><em>operation</em></span>, </td>
</tr>
<tr>
<td class="paramkey"></td>
@@ -213,9 +234,11 @@ Functions</h2></td></tr>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>none </dd></dl>
<p class="definition">Definition at line <a class="el" href="../../d7/d75/postfix__evaluation_8cpp_source.html#l00077">77</a> of file <a class="el" href="../../d7/d75/postfix__evaluation_8cpp_source.html">postfix_evaluation.cpp</a>.</p>
<div class="fragment"><div class="line"><span class="lineno"> 77</span> {</div>
<div class="line"><span class="lineno"> 78</span> <span class="keywordtype">float</span> c = 0;</div>
<div class="line"><span class="lineno"> 79</span> <span class="keyword">const</span> <span class="keywordtype">char</span> *op = operation.<a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/string/basic_string/c_str.html">c_str</a>();</div>
<div class="line"><span class="lineno"> 79</span> <span class="keyword">const</span> <span class="keywordtype">char</span> *op = operation.c_str();</div>
<div class="line"><span class="lineno"> 80</span> <span class="keywordflow">switch</span> (*op) {</div>
<div class="line"><span class="lineno"> 81</span> <span class="keywordflow">case</span> <span class="charliteral">&#39;+&#39;</span>:</div>
<div class="line"><span class="lineno"> 82</span> c = a + b; <span class="comment">// Addition of numbers</span></div>
@@ -238,20 +261,13 @@ Functions</h2></td></tr>
<div class="line"><span class="lineno"> 99</span> <span class="keywordflow">break</span>;</div>
<div class="line"><span class="lineno"> 100</span> </div>
<div class="line"><span class="lineno"> 101</span> <span class="keywordflow">default</span>:</div>
<div class="line"><span class="lineno"> 102</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> &lt;&lt; <span class="stringliteral">&quot;Operator not defined\n&quot;</span>;</div>
<div class="line"><span class="lineno"> 102</span> std::cout &lt;&lt; <span class="stringliteral">&quot;Operator not defined\n&quot;</span>;</div>
<div class="line"><span class="lineno"> 103</span> <span class="keywordflow">break</span>;</div>
<div class="line"><span class="lineno"> 104</span> }</div>
<div class="line"><span class="lineno"> 105</span>}</div>
<div class="ttc" id="abasic_ostream_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a></div></div>
<div class="ttc" id="ac_str_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/string/basic_string/c_str.html">std::string::c_str</a></div><div class="ttdeci">T c_str(T... args)</div></div>
<div class="ttc" id="aclassstack_html"><div class="ttname"><a href="../../d1/dc2/classstack.html">stack</a></div><div class="ttdoc">for std::invalid_argument</div><div class="ttdef"><b>Definition</b> stack.hpp:19</div></div>
<div class="ttc" id="apostfix__evaluation_8cpp_html_ad77f8c9cc594975756838d498c237cea"><div class="ttname"><a href="#ad77f8c9cc594975756838d498c237cea">others::postfix_expression::push</a></div><div class="ttdeci">void push(float operand, Stack *stack)</div><div class="ttdoc">Pushing operand, also called the number in the array to the stack.</div><div class="ttdef"><b>Definition</b> postfix_evaluation.cpp:44</div></div>
</div><!-- fragment --><div class="dynheader">
Here is the call graph for this function:</div>
<div class="dyncontent">
<div class="center"><iframe scrolling="no" frameborder="0" src="../../d7/d75/postfix__evaluation_8cpp_a59fd597e0ea394abe027ced4d2ea3338_cgraph.svg" width="408" height="104"><p><b>This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.</b></p></iframe></div>
</div>
<div class="ttc" id="aclassstack_html"><div class="ttname"><a href="../../d1/dc2/classstack.html">stack</a></div><div class="ttdoc">for std::invalid_argument</div><div class="ttdef"><b>Definition</b> <a href="../../df/d47/stack_8hpp_source.html#l00019">stack.hpp:19</a></div></div>
<div class="ttc" id="apostfix__evaluation_8cpp_html_ad77f8c9cc594975756838d498c237cea"><div class="ttname"><a href="#ad77f8c9cc594975756838d498c237cea">others::postfix_expression::push</a></div><div class="ttdeci">void push(float operand, Stack *stack)</div><div class="ttdoc">Pushing operand, also called the number in the array to the stack.</div><div class="ttdef"><b>Definition</b> <a href="../../d7/d75/postfix__evaluation_8cpp_source.html#l00044">postfix_evaluation.cpp:44</a></div></div>
</div><!-- fragment -->
</div>
</div>
<a id="a4c27f949c9d6659be9f5bd2ccbe1360a" name="a4c27f949c9d6659be9f5bd2ccbe1360a"></a>
@@ -263,7 +279,7 @@ Here is the call graph for this function:</div>
<tr>
<td class="memname">bool others::postfix_expression::is_number </td>
<td>(</td>
<td class="paramtype">const <a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/string/basic_string.html">std::string</a> &amp;</td> <td class="paramname"><span class="paramname"><em>s</em></span></td><td>)</td>
<td class="paramtype">const std::string &amp;</td> <td class="paramname"><span class="paramname"><em>s</em></span></td><td>)</td>
<td></td>
</tr>
</table>
@@ -277,19 +293,12 @@ Here is the call graph for this function:</div>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>bool boolean value if string is number </dd></dl>
<div class="fragment"><div class="line"><span class="lineno"> 65</span> {</div>
<div class="line"><span class="lineno"> 66</span> <span class="keywordflow">return</span> !s.<a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/string/basic_string/empty.html">empty</a>() &amp;&amp; <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/algorithm/all_any_none_of.html">std::all_of</a>(s.<a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/string/basic_string/begin.html">begin</a>(), s.<a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/string/basic_string/end.html">end</a>(), ::isdigit);</div>
<div class="line"><span class="lineno"> 67</span>}</div>
<div class="ttc" id="aall_any_none_of_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/algorithm/all_any_none_of.html">std::all_of</a></div><div class="ttdeci">T all_of(T... args)</div></div>
<div class="ttc" id="abegin_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/string/basic_string/begin.html">std::string::begin</a></div><div class="ttdeci">T begin(T... args)</div></div>
<div class="ttc" id="aempty_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/string/basic_string/empty.html">std::string::empty</a></div><div class="ttdeci">T empty(T... args)</div></div>
<div class="ttc" id="aend_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/string/basic_string/end.html">std::string::end</a></div><div class="ttdeci">T end(T... args)</div></div>
</div><!-- fragment --><div class="dynheader">
Here is the call graph for this function:</div>
<div class="dyncontent">
<div class="center"><iframe scrolling="no" frameborder="0" src="../../d7/d75/postfix__evaluation_8cpp_a4c27f949c9d6659be9f5bd2ccbe1360a_cgraph.svg" width="356" height="184"><p><b>This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.</b></p></iframe></div>
</div>
<p class="definition">Definition at line <a class="el" href="../../d7/d75/postfix__evaluation_8cpp_source.html#l00065">65</a> of file <a class="el" href="../../d7/d75/postfix__evaluation_8cpp_source.html">postfix_evaluation.cpp</a>.</p>
<div class="fragment"><div class="line"><span class="lineno"> 65</span> {</div>
<div class="line"><span class="lineno"> 66</span> <span class="keywordflow">return</span> !s.empty() &amp;&amp; std::all_of(s.begin(), s.end(), ::isdigit);</div>
<div class="line"><span class="lineno"> 67</span>}</div>
</div><!-- fragment -->
</div>
</div>
<a id="ae66f6b31b5ad750f1fe042a706a4e3d4" name="ae66f6b31b5ad750f1fe042a706a4e3d4"></a>
@@ -309,22 +318,19 @@ Here is the call graph for this function:</div>
<p>Main function. </p>
<dl class="section return"><dt>Returns</dt><dd>0 on exit </dd></dl>
<p class="definition">Definition at line <a class="el" href="../../d7/d75/postfix__evaluation_8cpp_source.html#l00171">171</a> of file <a class="el" href="../../d7/d75/postfix__evaluation_8cpp_source.html">postfix_evaluation.cpp</a>.</p>
<div class="fragment"><div class="line"><span class="lineno"> 171</span> {</div>
<div class="line"><span class="lineno"> 172</span> <a class="code hl_function" href="#a6a8eeb7d346d5cd6335d9780fb7c0f15">test_function_1</a>();</div>
<div class="line"><span class="lineno"> 173</span> <a class="code hl_function" href="#a5b97d12e8b61484f756a8721992bfae1">test_function_2</a>();</div>
<div class="line"><span class="lineno"> 174</span> </div>
<div class="line"><span class="lineno"> 175</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> &lt;&lt; <span class="stringliteral">&quot;\nTest implementations passed!\n&quot;</span>;</div>
<div class="line"><span class="lineno"> 175</span> std::cout &lt;&lt; <span class="stringliteral">&quot;\nTest implementations passed!\n&quot;</span>;</div>
<div class="line"><span class="lineno"> 176</span> </div>
<div class="line"><span class="lineno"> 177</span> <span class="keywordflow">return</span> 0;</div>
<div class="line"><span class="lineno"> 178</span>}</div>
<div class="ttc" id="apostfix__evaluation_8cpp_html_a5b97d12e8b61484f756a8721992bfae1"><div class="ttname"><a href="#a5b97d12e8b61484f756a8721992bfae1">test_function_2</a></div><div class="ttdeci">static void test_function_2()</div><div class="ttdoc">Test function 2 with input array {'1', '2', '+', '2', '/', '5', '*', '7', '+'}.</div><div class="ttdef"><b>Definition</b> postfix_evaluation.cpp:159</div></div>
<div class="ttc" id="apostfix__evaluation_8cpp_html_a6a8eeb7d346d5cd6335d9780fb7c0f15"><div class="ttname"><a href="#a6a8eeb7d346d5cd6335d9780fb7c0f15">test_function_1</a></div><div class="ttdeci">static void test_function_1()</div><div class="ttdoc">Test function 1 with input array {'2', '3', '1', '*', '+', '9', '-'}.</div><div class="ttdef"><b>Definition</b> postfix_evaluation.cpp:146</div></div>
</div><!-- fragment --><div class="dynheader">
Here is the call graph for this function:</div>
<div class="dyncontent">
<div class="center"><iframe scrolling="no" frameborder="0" src="../../d7/d75/postfix__evaluation_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.svg" width="219" height="86"><p><b>This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.</b></p></iframe></div>
</div>
<div class="ttc" id="apostfix__evaluation_8cpp_html_a5b97d12e8b61484f756a8721992bfae1"><div class="ttname"><a href="#a5b97d12e8b61484f756a8721992bfae1">test_function_2</a></div><div class="ttdeci">static void test_function_2()</div><div class="ttdoc">Test function 2 with input array {'1', '2', '+', '2', '/', '5', '*', '7', '+'}.</div><div class="ttdef"><b>Definition</b> <a href="../../d7/d75/postfix__evaluation_8cpp_source.html#l00159">postfix_evaluation.cpp:159</a></div></div>
<div class="ttc" id="apostfix__evaluation_8cpp_html_a6a8eeb7d346d5cd6335d9780fb7c0f15"><div class="ttname"><a href="#a6a8eeb7d346d5cd6335d9780fb7c0f15">test_function_1</a></div><div class="ttdeci">static void test_function_1()</div><div class="ttdoc">Test function 1 with input array {'2', '3', '1', '*', '+', '9', '-'}.</div><div class="ttdef"><b>Definition</b> <a href="../../d7/d75/postfix__evaluation_8cpp_source.html#l00146">postfix_evaluation.cpp:146</a></div></div>
</div><!-- fragment -->
</div>
</div>
<a id="a421baa2002a64bc0bfc3e1b64800d734" name="a421baa2002a64bc0bfc3e1b64800d734"></a>
@@ -350,12 +356,14 @@ Here is the call graph for this function:</div>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>operand float on top of stack </dd></dl>
<p class="definition">Definition at line <a class="el" href="../../d7/d75/postfix__evaluation_8cpp_source.html#l00054">54</a> of file <a class="el" href="../../d7/d75/postfix__evaluation_8cpp_source.html">postfix_evaluation.cpp</a>.</p>
<div class="fragment"><div class="line"><span class="lineno"> 54</span> {</div>
<div class="line"><span class="lineno"> 55</span> <span class="keywordtype">float</span> operand = <a class="code hl_class" href="../../d1/dc2/classstack.html">stack</a>-&gt;stack[<a class="code hl_class" href="../../d1/dc2/classstack.html">stack</a>-&gt;<a class="code hl_variable" href="../../d1/dc2/classstack.html#aefb3dac828e32b4ec014ff4b5d43a6b8">stackTop</a>];</div>
<div class="line"><span class="lineno"> 56</span> <a class="code hl_class" href="../../d1/dc2/classstack.html">stack</a>-&gt;<a class="code hl_variable" href="../../d1/dc2/classstack.html#aefb3dac828e32b4ec014ff4b5d43a6b8">stackTop</a>--;</div>
<div class="line"><span class="lineno"> 57</span> <span class="keywordflow">return</span> operand;</div>
<div class="line"><span class="lineno"> 58</span>}</div>
<div class="ttc" id="aclassstack_html_aefb3dac828e32b4ec014ff4b5d43a6b8"><div class="ttname"><a href="../../d1/dc2/classstack.html#aefb3dac828e32b4ec014ff4b5d43a6b8">stack::stackTop</a></div><div class="ttdeci">std::shared_ptr&lt; Node&lt; value_type &gt; &gt; stackTop</div><div class="ttdef"><b>Definition</b> stack.hpp:75</div></div>
<div class="ttc" id="aclassstack_html_aefb3dac828e32b4ec014ff4b5d43a6b8"><div class="ttname"><a href="../../d1/dc2/classstack.html#aefb3dac828e32b4ec014ff4b5d43a6b8">stack::stackTop</a></div><div class="ttdeci">std::shared_ptr&lt; Node&lt; value_type &gt; &gt; stackTop</div><div class="ttdef"><b>Definition</b> <a href="../../df/d47/stack_8hpp_source.html#l00075">stack.hpp:75</a></div></div>
</div><!-- fragment -->
</div>
</div>
@@ -365,12 +373,12 @@ Here is the call graph for this function:</div>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;<a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/types/size_t.html">std::size_t</a> N&gt; </div>
template&lt;std::size_t N&gt; </div>
<table class="memname">
<tr>
<td class="memname">float others::postfix_expression::postfix_evaluation </td>
<td>(</td>
<td class="paramtype"><a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/array.html">std::array</a>&lt; <a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/string/basic_string.html">std::string</a>, N &gt;</td> <td class="paramname"><span class="paramname"><em>input</em></span></td><td>)</td>
<td class="paramtype">std::array&lt; std::string, N &gt;</td> <td class="paramname"><span class="paramname"><em>input</em></span></td><td>)</td>
<td></td>
</tr>
</table>
@@ -390,14 +398,16 @@ template&lt;<a class="elRef" target="_blank" href="http://en.cppreference.com/w/
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>stack[stackTop] returns the top value from the stack </dd></dl>
<p class="definition">Definition at line <a class="el" href="../../d7/d75/postfix__evaluation_8cpp_source.html#l00115">115</a> of file <a class="el" href="../../d7/d75/postfix__evaluation_8cpp_source.html">postfix_evaluation.cpp</a>.</p>
<div class="fragment"><div class="line"><span class="lineno"> 115</span> {</div>
<div class="line"><span class="lineno"> 116</span> Stack <a class="code hl_variable" href="../../dc/dc5/paranthesis__matching_8cpp.html#aa37d24a036d239b3b528f13b9de880c7">stack</a>;</div>
<div class="line"><span class="lineno"> 117</span> <span class="keywordtype">int</span> j = 0;</div>
<div class="line"><span class="lineno"> 118</span> </div>
<div class="line"><span class="lineno"> 119</span> <span class="keywordflow">while</span> (j &lt; N) {</div>
<div class="line"><span class="lineno"> 120</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/string/basic_string.html">std::string</a> scan = input[j];</div>
<div class="line"><span class="lineno"> 120</span> std::string scan = input[j];</div>
<div class="line"><span class="lineno"> 121</span> <span class="keywordflow">if</span> (<a class="code hl_function" href="../../d8/d41/namespacegames_1_1memory__game.html#a33167bb9cce6d527b478b4f6ae8c3f59">is_number</a>(scan)) {</div>
<div class="line"><span class="lineno"> 122</span> push(<a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/string/basic_string/stof.html">std::stof</a>(scan), &amp;<a class="code hl_class" href="../../d1/dc2/classstack.html">stack</a>);</div>
<div class="line"><span class="lineno"> 122</span> push(std::stof(scan), &amp;<a class="code hl_class" href="../../d1/dc2/classstack.html">stack</a>);</div>
<div class="line"><span class="lineno"> 123</span> </div>
<div class="line"><span class="lineno"> 124</span> } <span class="keywordflow">else</span> {</div>
<div class="line"><span class="lineno"> 125</span> <span class="keywordtype">float</span> op2 = pop(&amp;<a class="code hl_class" href="../../d1/dc2/classstack.html">stack</a>);</div>
@@ -408,21 +418,14 @@ template&lt;<a class="elRef" target="_blank" href="http://en.cppreference.com/w/
<div class="line"><span class="lineno"> 130</span> j++;</div>
<div class="line"><span class="lineno"> 131</span> }</div>
<div class="line"><span class="lineno"> 132</span> </div>
<div class="line"><span class="lineno"> 133</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> &lt;&lt; <a class="code hl_class" href="../../d1/dc2/classstack.html">stack</a>.stack[<a class="code hl_class" href="../../d1/dc2/classstack.html">stack</a>.<a class="code hl_variable" href="../../d1/dc2/classstack.html#aefb3dac828e32b4ec014ff4b5d43a6b8">stackTop</a>] &lt;&lt; <span class="stringliteral">&quot;\n&quot;</span>;</div>
<div class="line"><span class="lineno"> 133</span> std::cout &lt;&lt; <a class="code hl_class" href="../../d1/dc2/classstack.html">stack</a>.stack[<a class="code hl_class" href="../../d1/dc2/classstack.html">stack</a>.<a class="code hl_variable" href="../../d1/dc2/classstack.html#aefb3dac828e32b4ec014ff4b5d43a6b8">stackTop</a>] &lt;&lt; <span class="stringliteral">&quot;\n&quot;</span>;</div>
<div class="line"><span class="lineno"> 134</span> </div>
<div class="line"><span class="lineno"> 135</span> <span class="keywordflow">return</span> <a class="code hl_class" href="../../d1/dc2/classstack.html">stack</a>.stack[<a class="code hl_class" href="../../d1/dc2/classstack.html">stack</a>.<a class="code hl_variable" href="../../d1/dc2/classstack.html#aefb3dac828e32b4ec014ff4b5d43a6b8">stackTop</a>];</div>
<div class="line"><span class="lineno"> 136</span>}</div>
<div class="ttc" id="abasic_string_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/string/basic_string.html">std::string</a></div></div>
<div class="ttc" id="anamespacegames_1_1memory__game_html_a33167bb9cce6d527b478b4f6ae8c3f59"><div class="ttname"><a href="../../d8/d41/namespacegames_1_1memory__game.html#a33167bb9cce6d527b478b4f6ae8c3f59">games::memory_game::is_number</a></div><div class="ttdeci">bool is_number(const T &amp;input)</div><div class="ttdoc">Utility function to verify if the given input is a number or not. This is very useful to prevent the ...</div><div class="ttdef"><b>Definition</b> memory_game.cpp:62</div></div>
<div class="ttc" id="aparanthesis__matching_8cpp_html_aa37d24a036d239b3b528f13b9de880c7"><div class="ttname"><a href="../../dc/dc5/paranthesis__matching_8cpp.html#aa37d24a036d239b3b528f13b9de880c7">stack</a></div><div class="ttdeci">char stack[MAX]</div><div class="ttdef"><b>Definition</b> paranthesis_matching.cpp:20</div></div>
<div class="ttc" id="apostfix__evaluation_8cpp_html_a59fd597e0ea394abe027ced4d2ea3338"><div class="ttname"><a href="#a59fd597e0ea394abe027ced4d2ea3338">others::postfix_expression::evaluate</a></div><div class="ttdeci">void evaluate(float a, float b, const std::string &amp;operation, Stack *stack)</div><div class="ttdoc">Evaluate answer using given last two operands from and operation.</div><div class="ttdef"><b>Definition</b> postfix_evaluation.cpp:77</div></div>
<div class="ttc" id="astof_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/string/basic_string/stof.html">std::stof</a></div><div class="ttdeci">T stof(T... args)</div></div>
</div><!-- fragment --><div class="dynheader">
Here is the call graph for this function:</div>
<div class="dyncontent">
<div class="center"><iframe scrolling="no" frameborder="0" src="../../d7/d75/postfix__evaluation_8cpp_ae38bd3a177a6d61da3859a281233bbe1_cgraph.svg" width="630" height="126"><p><b>This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.</b></p></iframe></div>
</div>
<div class="ttc" id="anamespacegames_1_1memory__game_html_a33167bb9cce6d527b478b4f6ae8c3f59"><div class="ttname"><a href="../../d8/d41/namespacegames_1_1memory__game.html#a33167bb9cce6d527b478b4f6ae8c3f59">games::memory_game::is_number</a></div><div class="ttdeci">bool is_number(const T &amp;input)</div><div class="ttdoc">Utility function to verify if the given input is a number or not. This is very useful to prevent the ...</div><div class="ttdef"><b>Definition</b> <a href="../../dd/d92/memory__game_8cpp_source.html#l00062">memory_game.cpp:62</a></div></div>
<div class="ttc" id="aparanthesis__matching_8cpp_html_aa37d24a036d239b3b528f13b9de880c7"><div class="ttname"><a href="../../dc/dc5/paranthesis__matching_8cpp.html#aa37d24a036d239b3b528f13b9de880c7">stack</a></div><div class="ttdeci">char stack[MAX]</div><div class="ttdef"><b>Definition</b> <a href="../../dc/dc5/paranthesis__matching_8cpp_source.html#l00020">paranthesis_matching.cpp:20</a></div></div>
<div class="ttc" id="apostfix__evaluation_8cpp_html_a59fd597e0ea394abe027ced4d2ea3338"><div class="ttname"><a href="#a59fd597e0ea394abe027ced4d2ea3338">others::postfix_expression::evaluate</a></div><div class="ttdeci">void evaluate(float a, float b, const std::string &amp;operation, Stack *stack)</div><div class="ttdoc">Evaluate answer using given last two operands from and operation.</div><div class="ttdef"><b>Definition</b> <a href="../../d7/d75/postfix__evaluation_8cpp_source.html#l00077">postfix_evaluation.cpp:77</a></div></div>
</div><!-- fragment -->
</div>
</div>
<a id="ad77f8c9cc594975756838d498c237cea" name="ad77f8c9cc594975756838d498c237cea"></a>
@@ -453,6 +456,8 @@ Here is the call graph for this function:</div>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>none </dd></dl>
<p class="definition">Definition at line <a class="el" href="../../d7/d75/postfix__evaluation_8cpp_source.html#l00044">44</a> of file <a class="el" href="../../d7/d75/postfix__evaluation_8cpp_source.html">postfix_evaluation.cpp</a>.</p>
<div class="fragment"><div class="line"><span class="lineno"> 44</span> {</div>
<div class="line"><span class="lineno"> 45</span> <a class="code hl_class" href="../../d1/dc2/classstack.html">stack</a>-&gt;<a class="code hl_variable" href="../../d1/dc2/classstack.html#aefb3dac828e32b4ec014ff4b5d43a6b8">stackTop</a>++;</div>
<div class="line"><span class="lineno"> 46</span> <a class="code hl_class" href="../../d1/dc2/classstack.html">stack</a>-&gt;stack[<a class="code hl_class" href="../../d1/dc2/classstack.html">stack</a>-&gt;<a class="code hl_variable" href="../../d1/dc2/classstack.html#aefb3dac828e32b4ec014ff4b5d43a6b8">stackTop</a>] = operand;</div>
@@ -485,15 +490,16 @@ Here is the call graph for this function:</div>
<p>Test function 1 with input array {'2', '3', '1', '*', '+', '9', '-'}. </p>
<dl class="section return"><dt>Returns</dt><dd>none </dd></dl>
<p class="definition">Definition at line <a class="el" href="../../d7/d75/postfix__evaluation_8cpp_source.html#l00146">146</a> of file <a class="el" href="../../d7/d75/postfix__evaluation_8cpp_source.html">postfix_evaluation.cpp</a>.</p>
<div class="fragment"><div class="line"><span class="lineno"> 146</span> {</div>
<div class="line"><span class="lineno"> 147</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/array.html">std::array&lt;std::string, 7&gt;</a> input = {<span class="stringliteral">&quot;2&quot;</span>, <span class="stringliteral">&quot;3&quot;</span>, <span class="stringliteral">&quot;1&quot;</span>, <span class="stringliteral">&quot;*&quot;</span>, <span class="stringliteral">&quot;+&quot;</span>, <span class="stringliteral">&quot;9&quot;</span>, <span class="stringliteral">&quot;-&quot;</span>};</div>
<div class="line"><span class="lineno"> 147</span> std::array&lt;std::string, 7&gt; input = {<span class="stringliteral">&quot;2&quot;</span>, <span class="stringliteral">&quot;3&quot;</span>, <span class="stringliteral">&quot;1&quot;</span>, <span class="stringliteral">&quot;*&quot;</span>, <span class="stringliteral">&quot;+&quot;</span>, <span class="stringliteral">&quot;9&quot;</span>, <span class="stringliteral">&quot;-&quot;</span>};</div>
<div class="line"><span class="lineno"> 148</span> </div>
<div class="line"><span class="lineno"> 149</span> <span class="keywordtype">float</span> answer = <a class="code hl_function" href="#ae38bd3a177a6d61da3859a281233bbe1">others::postfix_expression::postfix_evaluation</a>(input);</div>
<div class="line"><span class="lineno"> 150</span> </div>
<div class="line"><span class="lineno"> 151</span> assert(answer == -4);</div>
<div class="line"><span class="lineno"> 152</span>}</div>
<div class="ttc" id="aarray_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/container/array.html">std::array</a></div></div>
<div class="ttc" id="apostfix__evaluation_8cpp_html_ae38bd3a177a6d61da3859a281233bbe1"><div class="ttname"><a href="#ae38bd3a177a6d61da3859a281233bbe1">others::postfix_expression::postfix_evaluation</a></div><div class="ttdeci">float postfix_evaluation(std::array&lt; std::string, N &gt; input)</div><div class="ttdoc">Postfix Evaluation algorithm to compute the value from given input array.</div><div class="ttdef"><b>Definition</b> postfix_evaluation.cpp:115</div></div>
<div class="ttc" id="apostfix__evaluation_8cpp_html_ae38bd3a177a6d61da3859a281233bbe1"><div class="ttname"><a href="#ae38bd3a177a6d61da3859a281233bbe1">others::postfix_expression::postfix_evaluation</a></div><div class="ttdeci">float postfix_evaluation(std::array&lt; std::string, N &gt; input)</div><div class="ttdoc">Postfix Evaluation algorithm to compute the value from given input array.</div><div class="ttdef"><b>Definition</b> <a href="../../d7/d75/postfix__evaluation_8cpp_source.html#l00115">postfix_evaluation.cpp:115</a></div></div>
</div><!-- fragment -->
</div>
</div>
@@ -522,8 +528,10 @@ Here is the call graph for this function:</div>
<p>Test function 2 with input array {'1', '2', '+', '2', '/', '5', '*', '7', '+'}. </p>
<dl class="section return"><dt>Returns</dt><dd>none </dd></dl>
<p class="definition">Definition at line <a class="el" href="../../d7/d75/postfix__evaluation_8cpp_source.html#l00159">159</a> of file <a class="el" href="../../d7/d75/postfix__evaluation_8cpp_source.html">postfix_evaluation.cpp</a>.</p>
<div class="fragment"><div class="line"><span class="lineno"> 159</span> {</div>
<div class="line"><span class="lineno"> 160</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/array.html">std::array&lt;std::string, 9&gt;</a> input = {<span class="stringliteral">&quot;100&quot;</span>, <span class="stringliteral">&quot;200&quot;</span>, <span class="stringliteral">&quot;+&quot;</span>, <span class="stringliteral">&quot;2&quot;</span>, <span class="stringliteral">&quot;/&quot;</span>,</div>
<div class="line"><span class="lineno"> 160</span> std::array&lt;std::string, 9&gt; input = {<span class="stringliteral">&quot;100&quot;</span>, <span class="stringliteral">&quot;200&quot;</span>, <span class="stringliteral">&quot;+&quot;</span>, <span class="stringliteral">&quot;2&quot;</span>, <span class="stringliteral">&quot;/&quot;</span>,</div>
<div class="line"><span class="lineno"> 161</span> <span class="stringliteral">&quot;5&quot;</span>, <span class="stringliteral">&quot;*&quot;</span>, <span class="stringliteral">&quot;7&quot;</span>, <span class="stringliteral">&quot;+&quot;</span>};</div>
<div class="line"><span class="lineno"> 162</span> <span class="keywordtype">float</span> answer = <a class="code hl_function" href="#ae38bd3a177a6d61da3859a281233bbe1">others::postfix_expression::postfix_evaluation</a>(input);</div>
<div class="line"><span class="lineno"> 163</span> </div>