mirror of
https://github.com/TheAlgorithms/C-Plus-Plus.git
synced 2026-03-23 21:32:09 +08:00
Documentation for c26eea874d
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
|
||||
<meta name="generator" content="Doxygen 1.12.0"/>
|
||||
<meta name="generator" content="Doxygen 1.13.2"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1"/>
|
||||
<title>TheAlgorithms/C++: math/power_of_two.cpp Source File</title>
|
||||
<link rel="icon" href="../../favicon.svg" type="image/x-icon" />
|
||||
@@ -60,7 +60,7 @@ window.MathJax = {
|
||||
</table>
|
||||
</div>
|
||||
<!-- end header part -->
|
||||
<!-- Generated by Doxygen 1.12.0 -->
|
||||
<!-- Generated by Doxygen 1.13.2 -->
|
||||
<script type="text/javascript">
|
||||
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
|
||||
var searchBox = new SearchBox("searchBox", "../../search/",'.html');
|
||||
@@ -124,11 +124,12 @@ $(function(){initNavTree('d4/d38/power__of__two_8cpp_source.html','../../'); ini
|
||||
<div class="headertitle"><div class="title">power_of_two.cpp</div></div>
|
||||
</div><!--header-->
|
||||
<div class="contents">
|
||||
<a href="../../d4/d38/power__of__two_8cpp.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a id="l00001" name="l00001"></a><span class="lineno"> 1</span> </div>
|
||||
<a href="../../d4/d38/power__of__two_8cpp.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a id="l00001" name="l00001"></a><span class="lineno"> 1</span></div>
|
||||
<div class="line"><a id="l00024" name="l00024"></a><span class="lineno"> 24</span> </div>
|
||||
<div class="line"><a id="l00025" name="l00025"></a><span class="lineno"> 25</span><span class="preprocessor">#include <iostream></span> </div>
|
||||
<div class="line"><a id="l00026" name="l00026"></a><span class="lineno"> 26</span><span class="preprocessor">#include <cassert></span> </div>
|
||||
<div class="line"><a id="l00027" name="l00027"></a><span class="lineno"> 27</span> </div>
|
||||
<div class="line"><a id="l00028" name="l00028"></a><span class="lineno"> 28</span> </div>
|
||||
<div class="line"><a id="l00028" name="l00028"></a><span class="lineno"> 28</span></div>
|
||||
<div class="line"><a id="l00033" name="l00033"></a><span class="lineno"> 33</span><span class="keyword">namespace </span><a class="code hl_namespace" href="../../dd/d47/namespacemath.html">math</a> {</div>
|
||||
<div class="foldopen" id="foldopen00042" data-start="{" data-end="}">
|
||||
<div class="line"><a id="l00042" name="l00042"></a><span class="lineno"><a class="line" href="../../dd/d47/namespacemath.html#a8a48be4d7f14e34c5c92925bc1cbf3bb"> 42</a></span><span class="keywordtype">int</span> <a class="code hl_function" href="../../dd/d47/namespacemath.html#a8a48be4d7f14e34c5c92925bc1cbf3bb">power_of_two</a>(<span class="keywordtype">int</span> n) {</div>
|
||||
@@ -142,7 +143,7 @@ $(function(){initNavTree('d4/d38/power__of__two_8cpp_source.html','../../'); ini
|
||||
<div class="line"><a id="l00052" name="l00052"></a><span class="lineno"> 52</span>}</div>
|
||||
</div>
|
||||
<div class="line"><a id="l00053" name="l00053"></a><span class="lineno"> 53</span>} <span class="comment">// namespace math</span></div>
|
||||
<div class="line"><a id="l00054" name="l00054"></a><span class="lineno"> 54</span> </div>
|
||||
<div class="line"><a id="l00054" name="l00054"></a><span class="lineno"> 54</span></div>
|
||||
<div class="foldopen" id="foldopen00059" data-start="{" data-end="}">
|
||||
<div class="line"><a id="l00059" name="l00059"></a><span class="lineno"><a class="line" href="../../d4/d38/power__of__two_8cpp.html#aa8dca7b867074164d5f45b0f3851269d"> 59</a></span><span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code hl_function" href="../../d4/d38/power__of__two_8cpp.html#aa8dca7b867074164d5f45b0f3851269d">test</a>() {</div>
|
||||
<div class="line"><a id="l00060" name="l00060"></a><span class="lineno"> 60</span> std::cout << <span class="stringliteral">"First case testing... \n"</span>; <span class="comment">// for n = 32 return 1</span></div>
|
||||
@@ -160,14 +161,14 @@ $(function(){initNavTree('d4/d38/power__of__two_8cpp_source.html','../../'); ini
|
||||
<div class="line"><a id="l00072" name="l00072"></a><span class="lineno"> 72</span> std::cout << <span class="stringliteral">"\nAll test cases have successfully passed!\n"</span>;</div>
|
||||
<div class="line"><a id="l00073" name="l00073"></a><span class="lineno"> 73</span>}</div>
|
||||
</div>
|
||||
<div class="line"><a id="l00074" name="l00074"></a><span class="lineno"> 74</span> </div>
|
||||
<div class="line"><a id="l00074" name="l00074"></a><span class="lineno"> 74</span></div>
|
||||
<div class="foldopen" id="foldopen00079" data-start="{" data-end="}">
|
||||
<div class="line"><a id="l00079" name="l00079"></a><span class="lineno"><a class="line" href="../../d4/d38/power__of__two_8cpp.html#adfd6be45be425ae28c62ce3bfb4b40dc"> 79</a></span><span class="keywordtype">void</span> <a class="code hl_function" href="../../d4/d38/power__of__two_8cpp.html#adfd6be45be425ae28c62ce3bfb4b40dc">user_input_test</a>() {</div>
|
||||
<div class="line"><a id="l00080" name="l00080"></a><span class="lineno"> 80</span> <span class="keywordtype">int</span> n = 0; <span class="comment">// input from user</span></div>
|
||||
<div class="line"><a id="l00081" name="l00081"></a><span class="lineno"> 81</span> </div>
|
||||
<div class="line"><a id="l00082" name="l00082"></a><span class="lineno"> 82</span> std::cout << <span class="stringliteral">"Enter a number "</span> << std::endl;</div>
|
||||
<div class="line"><a id="l00083" name="l00083"></a><span class="lineno"> 83</span> std::cin >> n; </div>
|
||||
<div class="line"><a id="l00084" name="l00084"></a><span class="lineno"> 84</span> </div>
|
||||
<div class="line"><a id="l00084" name="l00084"></a><span class="lineno"> 84</span></div>
|
||||
<div class="line"><a id="l00086" name="l00086"></a><span class="lineno"> 86</span> <span class="keywordtype">int</span> result = <a class="code hl_function" href="../../dd/d47/namespacemath.html#a8a48be4d7f14e34c5c92925bc1cbf3bb">math::power_of_two</a>(n);</div>
|
||||
<div class="line"><a id="l00087" name="l00087"></a><span class="lineno"> 87</span> <span class="keywordflow">if</span> (result == 1) {</div>
|
||||
<div class="line"><a id="l00088" name="l00088"></a><span class="lineno"> 88</span> std::cout << <span class="stringliteral">"Yes, the number "</span> << n << <span class="stringliteral">" is a power of 2\n"</span>;</div>
|
||||
@@ -177,7 +178,7 @@ $(function(){initNavTree('d4/d38/power__of__two_8cpp_source.html','../../'); ini
|
||||
<div class="line"><a id="l00092" name="l00092"></a><span class="lineno"> 92</span> }</div>
|
||||
<div class="line"><a id="l00093" name="l00093"></a><span class="lineno"> 93</span>}</div>
|
||||
</div>
|
||||
<div class="line"><a id="l00094" name="l00094"></a><span class="lineno"> 94</span> </div>
|
||||
<div class="line"><a id="l00094" name="l00094"></a><span class="lineno"> 94</span></div>
|
||||
<div class="foldopen" id="foldopen00099" data-start="{" data-end="}">
|
||||
<div class="line"><a id="l00099" name="l00099"></a><span class="lineno"><a class="line" href="../../d4/d38/power__of__two_8cpp.html#ae66f6b31b5ad750f1fe042a706a4e3d4"> 99</a></span><span class="keywordtype">int</span> <a class="code hl_function" href="../../d4/d38/power__of__two_8cpp.html#ae66f6b31b5ad750f1fe042a706a4e3d4">main</a>() {</div>
|
||||
<div class="line"><a id="l00100" name="l00100"></a><span class="lineno"> 100</span> <a class="code hl_function" href="../../d4/d38/power__of__two_8cpp.html#aa8dca7b867074164d5f45b0f3851269d">test</a>(); <span class="comment">// run self-test implementations</span></div>
|
||||
@@ -199,7 +200,7 @@ $(function(){initNavTree('d4/d38/power__of__two_8cpp_source.html','../../'); ini
|
||||
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
|
||||
<ul>
|
||||
<li class="navelem"><a class="el" href="../../dir_296d53ceaeaa7e099814a6def439fe8a.html">math</a></li><li class="navelem"><a class="el" href="../../d4/d38/power__of__two_8cpp.html">power_of_two.cpp</a></li>
|
||||
<li class="footer">Generated by <a href="https://www.doxygen.org/index.html"><img class="footer" src="../../doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.12.0 </li>
|
||||
<li class="footer">Generated by <a href="https://www.doxygen.org/index.html"><img class="footer" src="../../doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.13.2 </li>
|
||||
</ul>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
Reference in New Issue
Block a user