]> git.vanrenterghem.biz Git - www.vanrenterghem.biz.git/blob - Linux/while_oef.cpp.shtml
Baseline
[www.vanrenterghem.biz.git] / Linux / while_oef.cpp.shtml
1 <html>
2 <head>
3 <title>~/code/while_oef.cpp.html</title>
4 <meta name="Generator" content="Vim/6.3" />
5 <meta http-equiv="content-type" content="text/html; charset=ISO-8859-15" />
6 <meta name="author" content="Frederik Vanrenterghem" />
7 <link rel="stylesheet" href="/styles/header.css" type="text/css" />
8 <link rel="stylesheet" href="/styles/main.css" type="text/css" />
9 </head>
10 <body>
11 <!--#include virtual='/header.shtml' -->
12 <pre>
13 <font color="#ff40ff">#include </font><font color="#ff6060">&lt;iostream&gt;</font>
14 <font color="#ffff00">using</font> <font color="#00ff00">namespace</font> std;
15 <font color="#00ff00">int</font> main()
16 {
17   <font color="#00ff00">int</font> x=<font color="#ff6060">0</font>,y=<font color="#ff6060">1</font>,z,i=<font color="#ff6060">1</font>,n;
18   cout &lt;&lt; <font color="#ff6060">&quot;Geef een natuurlijk getal: &quot;</font>;
19   cin &gt;&gt; n;
20   cout &lt;&lt; <font color="#ff6060">&quot;De reeks gaat als volgt: &quot;</font>;
21   <font color="#ffff00">while</font> (i++&lt;n)
22           {
23                   z=x+y;
24                   y=x;
25                   x=z;
26                   cout &lt;&lt; z &lt;&lt;<font color="#ff6060">&quot;, &quot;</font>;
27           }
28   cout &lt;&lt; x+y &lt;&lt; <font color="#ff6060">&quot;.&quot;</font> &lt;&lt; endl;
29   <font color="#ffff00">return</font> <font color="#ff6060">0</font>;
30 }
31 </pre>
32 <!--#include virtual='/footer.shtml' -->
33 </body>
34 </html>