<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://performiq.com/kb/index.php?action=history&amp;feed=atom&amp;title=C%2B%2B_Code_Examples</id>
	<title>C++ Code Examples - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://performiq.com/kb/index.php?action=history&amp;feed=atom&amp;title=C%2B%2B_Code_Examples"/>
	<link rel="alternate" type="text/html" href="https://performiq.com/kb/index.php?title=C%2B%2B_Code_Examples&amp;action=history"/>
	<updated>2026-05-18T22:01:19Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.37.1</generator>
	<entry>
		<id>https://performiq.com/kb/index.php?title=C%2B%2B_Code_Examples&amp;diff=1213&amp;oldid=prev</id>
		<title>PeterHarding at 07:28, 10 February 2008</title>
		<link rel="alternate" type="text/html" href="https://performiq.com/kb/index.php?title=C%2B%2B_Code_Examples&amp;diff=1213&amp;oldid=prev"/>
		<updated>2008-02-10T07:28:37Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 17:28, 10 February 2008&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l1&quot;&gt;Line 1:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;=Simple=&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;=Simple &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;I/O&lt;/ins&gt;=&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt; &lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;A simple bit of code illustrating I/O operations in C++ stdio.&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;pre&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;pre&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>PeterHarding</name></author>
	</entry>
	<entry>
		<id>https://performiq.com/kb/index.php?title=C%2B%2B_Code_Examples&amp;diff=1212&amp;oldid=prev</id>
		<title>PeterHarding: New page: =Simple=  &lt;pre&gt; #include &lt;iostream.h&gt; #include &lt;fstream.h&gt; #include &lt;stdlib.h&gt; #include &lt;stdio.h&gt;  const int             MAX_NUMBERS = 1000;             // Max numbers in file const char  ...</title>
		<link rel="alternate" type="text/html" href="https://performiq.com/kb/index.php?title=C%2B%2B_Code_Examples&amp;diff=1212&amp;oldid=prev"/>
		<updated>2008-02-10T07:27:57Z</updated>

		<summary type="html">&lt;p&gt;New page: =Simple=  &amp;lt;pre&amp;gt; #include &amp;lt;iostream.h&amp;gt; #include &amp;lt;fstream.h&amp;gt; #include &amp;lt;stdlib.h&amp;gt; #include &amp;lt;stdio.h&amp;gt;  const int             MAX_NUMBERS = 1000;             // Max numbers in file const char  ...&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;=Simple=&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#include &amp;lt;iostream.h&amp;gt;&lt;br /&gt;
#include &amp;lt;fstream.h&amp;gt;&lt;br /&gt;
#include &amp;lt;stdlib.h&amp;gt;&lt;br /&gt;
#include &amp;lt;stdio.h&amp;gt;&lt;br /&gt;
&lt;br /&gt;
const int             MAX_NUMBERS = 1000;             // Max numbers in file&lt;br /&gt;
const char           *DATA_FILE = &amp;quot;numbers.dat&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
int data[MAX_NUMBERS];&lt;br /&gt;
int max_count;&lt;br /&gt;
&lt;br /&gt;
main()&lt;br /&gt;
{&lt;br /&gt;
        ifstream in_file;&lt;br /&gt;
        int low;&lt;br /&gt;
        int middle;&lt;br /&gt;
        int high;&lt;br /&gt;
        int search;&lt;br /&gt;
&lt;br /&gt;
        in_file.open(DATA_FILE, ios::in);&lt;br /&gt;
&lt;br /&gt;
        if (in_file.bad()) {&lt;br /&gt;
                cout &amp;lt;&amp;lt; &amp;quot;Error: unable to open &amp;quot; &amp;lt;&amp;lt; DATA_FILE &amp;lt;&amp;lt; &amp;#039;\n&amp;#039;;&lt;br /&gt;
                exit(8);&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        max_count = 0;&lt;br /&gt;
&lt;br /&gt;
        while (1) {&lt;br /&gt;
                char line[30];&lt;br /&gt;
&lt;br /&gt;
                if (in_file.eof())&lt;br /&gt;
                                  break;&lt;br /&gt;
&lt;br /&gt;
                in_file.getline(line, sizeof(line));&lt;br /&gt;
&lt;br /&gt;
                sscanf(line, &amp;quot;%d&amp;quot;, data[max_count]);&lt;br /&gt;
&lt;br /&gt;
                if (data[max_count] == -1)&lt;br /&gt;
                        break;&lt;br /&gt;
&lt;br /&gt;
                ++max_count;&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        while (1) {&lt;br /&gt;
                cout &amp;lt;&amp;lt; &amp;quot;Enter:&amp;quot;;&lt;br /&gt;
                cin &amp;gt;&amp;gt; search;&lt;br /&gt;
&lt;br /&gt;
                if (search == -1)&lt;br /&gt;
                                  break;&lt;br /&gt;
&lt;br /&gt;
                for (int i = 0; i++; i &amp;lt; max_count) {&lt;br /&gt;
                                  cout &amp;lt;&amp;lt; data[i];&lt;br /&gt;
                }&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        return(0);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>PeterHarding</name></author>
	</entry>
</feed>