<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>spechal.com &#187; C++</title>
	<atom:link href="http://spechal.com/tag/c/feed/" rel="self" type="application/rss+xml" />
	<link>http://spechal.com</link>
	<description>[spesh-uhl]</description>
	<lastBuildDate>Thu, 21 Jan 2010 11:50:50 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>C++ Read from a file using fstream</title>
		<link>http://spechal.com/2009/11/16/c-read-from-a-file-using-fstream/</link>
		<comments>http://spechal.com/2009/11/16/c-read-from-a-file-using-fstream/#comments</comments>
		<pubDate>Mon, 16 Nov 2009 15:32:59 +0000</pubDate>
		<dc:creator>Spechal</dc:creator>
				<category><![CDATA[C++]]></category>

		<guid isPermaLink="false">http://spechal.com/?p=42</guid>
		<description><![CDATA[
/**
  Read from a file (version 1)
  Copyright 2009 Travis Crowder
  travis.crowder@spechal.com
  Published under the MIT License
*/
#include &#60;iostream&#62;
#include &#60;fstream&#62;
#include &#60;string&#62;

int main(int argc, char* argv[]){

  // create the file handle, opening the file
  std::fstream myFile(&#34;text.txt&#34;, std::ios::in);

  // create a string to hold the line
  std::string line;

  if(myFile.is_open()){
 [...]]]></description>
			<content:encoded><![CDATA[<pre class="cpp" name="code">
/**
  Read from a file (version 1)
  Copyright 2009 Travis Crowder
  travis.crowder@spechal.com
  Published under the MIT License
*/
#include &lt;iostream&gt;
#include &lt;fstream&gt;
#include &lt;string&gt;

int main(int argc, char* argv[]){

  // create the file handle, opening the file
  std::fstream myFile(&quot;text.txt&quot;, std::ios::in);

  // create a string to hold the line
  std::string line;

  if(myFile.is_open()){
    while(!myFile.eof()){
      getline(myFile, line);
      std::cout &lt;&lt; line &lt;&lt; std::endl;
    }
  } else {
    std::cout &lt;&lt; &quot;Could not open text.txt for reading.&quot; &lt;&lt; std::endl;
    return -1;
  }

  return 0;
}
</pre>
]]></content:encoded>
			<wfw:commentRss>http://spechal.com/2009/11/16/c-read-from-a-file-using-fstream/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>C++ Palindrome Checker</title>
		<link>http://spechal.com/2009/11/16/c-palindrome-checker/</link>
		<comments>http://spechal.com/2009/11/16/c-palindrome-checker/#comments</comments>
		<pubDate>Mon, 16 Nov 2009 13:48:38 +0000</pubDate>
		<dc:creator>Spechal</dc:creator>
				<category><![CDATA[C++]]></category>

		<guid isPermaLink="false">http://spechal.com/?p=32</guid>
		<description><![CDATA[
/**
  Palindrome Checker
  Copyright 2009 Travis Crowder
  Published under the MIT License
*/

#include &#60;iostream&#62;
#include &#60;algorithm&#62;
#include &#60;string&#62;

bool isPalindrome(const std::string theWord);

int main(int argc, char* argv[]){

  std::string theWord;

  if(!argv[1]){
    std::cout &#60;&#60; &#34;Enter the word to check: &#34;;
    std::cin &#62;&#62; theWord;
  } else {
    theWord [...]]]></description>
			<content:encoded><![CDATA[<pre class="cpp" name="code">
/**
  Palindrome Checker
  Copyright 2009 Travis Crowder
  Published under the MIT License
*/

#include &lt;iostream&gt;
#include &lt;algorithm&gt;
#include &lt;string&gt;

bool isPalindrome(const std::string theWord);

int main(int argc, char* argv[]){

  std::string theWord;

  if(!argv[1]){
    std::cout &lt;&lt; &quot;Enter the word to check: &quot;;
    std::cin &gt;&gt; theWord;
  } else {
    theWord = argv[1];
  }
  std::cout &lt;&lt; std::endl;

  /**
    Make all of the characters lower case
  */
  int i = 0;
  while(theWord[i]){
    if(isupper(theWord[i]))
      theWord[i] = tolower(theWord[i]);
    i++;
  }

  std::cout &lt;&lt; theWord &lt;&lt; &quot; is &quot;;
  if(!isPalindrome(theWord))
    std::cout &lt;&lt; &quot;NOT &quot;;
  std::cout &lt;&lt; &quot;a palindrome.&quot; &lt;&lt; std::endl;
  return 0;
}

bool isPalindrome(const std::string theWord){
  std::string tmp = theWord;
  reverse(tmp.begin(), tmp.end());
  if(tmp == theWord)
    return true;
  return false;
}
</pre>
]]></content:encoded>
			<wfw:commentRss>http://spechal.com/2009/11/16/c-palindrome-checker/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
