<?xml version="1.0"?>
<?xml-stylesheet type="text/css" href="http://www.programmingexamples.net/w/skins/common/feed.css?303"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>http://www.programmingexamples.net/w/index.php?action=history&amp;feed=atom&amp;title=CPP%2FLoops%2FDoWhile</id>
		<title>CPP/Loops/DoWhile - Revision history</title>
		<link rel="self" type="application/atom+xml" href="http://www.programmingexamples.net/w/index.php?action=history&amp;feed=atom&amp;title=CPP%2FLoops%2FDoWhile"/>
		<link rel="alternate" type="text/html" href="http://www.programmingexamples.net/w/index.php?title=CPP/Loops/DoWhile&amp;action=history"/>
		<updated>2026-05-26T01:09:37Z</updated>
		<subtitle>Revision history for this page on the wiki</subtitle>
		<generator>MediaWiki 1.23.5</generator>

	<entry>
		<id>http://www.programmingexamples.net/w/index.php?title=CPP/Loops/DoWhile&amp;diff=57&amp;oldid=prev</id>
		<title>Daviddoria: Created page with '==DoWhile.cpp== &lt;source lang=&quot;cpp&quot;&gt; #include &lt;iostream&gt; #include &lt;string&gt; #include &lt;cstdlib&gt; #include &lt;sstream&gt; #include &lt;fstream&gt;  int main(int argc, char *argv[]) {   if(argc !…'</title>
		<link rel="alternate" type="text/html" href="http://www.programmingexamples.net/w/index.php?title=CPP/Loops/DoWhile&amp;diff=57&amp;oldid=prev"/>
				<updated>2010-06-23T12:08:56Z</updated>
		
		<summary type="html">&lt;p&gt;Created page with &amp;#039;==DoWhile.cpp== &amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt; #include &amp;lt;iostream&amp;gt; #include &amp;lt;string&amp;gt; #include &amp;lt;cstdlib&amp;gt; #include &amp;lt;sstream&amp;gt; #include &amp;lt;fstream&amp;gt;  int main(int argc, char *argv[]) {   if(argc !…&amp;#039;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;==DoWhile.cpp==&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
#include &amp;lt;iostream&amp;gt;&lt;br /&gt;
#include &amp;lt;string&amp;gt;&lt;br /&gt;
#include &amp;lt;cstdlib&amp;gt;&lt;br /&gt;
#include &amp;lt;sstream&amp;gt;&lt;br /&gt;
#include &amp;lt;fstream&amp;gt;&lt;br /&gt;
&lt;br /&gt;
int main(int argc, char *argv[])&lt;br /&gt;
{&lt;br /&gt;
  if(argc != 2)&lt;br /&gt;
  {&lt;br /&gt;
    std::cout &amp;lt;&amp;lt; &amp;quot;Required parameters: InputFilename&amp;quot; &amp;lt;&amp;lt; std::endl;&lt;br /&gt;
    exit(-1);&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
  std::string InputFilename = argv[1];&lt;br /&gt;
&lt;br /&gt;
  std::ifstream in(InputFilename.c_str());&lt;br /&gt;
&lt;br /&gt;
  if (!in) &lt;br /&gt;
  {&lt;br /&gt;
    std::cout &amp;lt;&amp;lt; &amp;quot;File &amp;quot; &amp;lt;&amp;lt; InputFilename &amp;lt;&amp;lt; &amp;quot; not found&amp;quot; &amp;lt;&amp;lt; std::endl;&lt;br /&gt;
    exit(-1);&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
#if 0 //bad way&lt;br /&gt;
  std::string line;&lt;br /&gt;
  while(getline(in, line))&lt;br /&gt;
  {&lt;br /&gt;
    if(line[0] == '#') //we found the first line we were looking for, need to switch to the next loop&lt;br /&gt;
    {&lt;br /&gt;
      break;&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
  &lt;br /&gt;
  //start reading data - //woops - we missed the first line of interests (here the line starting with #)&lt;br /&gt;
  while(getline(in, line))&lt;br /&gt;
  {&lt;br /&gt;
    std::cout &amp;lt;&amp;lt; line &amp;lt;&amp;lt; std::endl;&lt;br /&gt;
  }&lt;br /&gt;
#else&lt;br /&gt;
  std::string line;&lt;br /&gt;
  &lt;br /&gt;
  while(getline(in, line))&lt;br /&gt;
  {&lt;br /&gt;
    if(line[0] == '#') //we found the first line we were looking for, need to switch to the next loop&lt;br /&gt;
    {&lt;br /&gt;
      break;&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
  &lt;br /&gt;
  //start reading data - //woops - we missed the first line of interests (here the line starting with #)&lt;br /&gt;
  do&lt;br /&gt;
  {&lt;br /&gt;
    std::cout &amp;lt;&amp;lt; line &amp;lt;&amp;lt; std::endl;&lt;br /&gt;
  }while(getline(in, line));&lt;br /&gt;
#endif&lt;br /&gt;
&lt;br /&gt;
  return 0;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;/div&gt;</summary>
		<author><name>Daviddoria</name></author>	</entry>

	</feed>