<?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>Compiled Thoughts by John Ciacia &#187; cpp</title>
	<atom:link href="http://www.johnciacia.com/tag/cpp/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.johnciacia.com</link>
	<description>Science, Technology, and Beyond</description>
	<lastBuildDate>Fri, 06 Jan 2012 15:46:22 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Decimal to Roman Numeral Conversion</title>
		<link>http://www.johnciacia.com/2009/05/21/decimal-to-roman-numeral-conversion/</link>
		<comments>http://www.johnciacia.com/2009/05/21/decimal-to-roman-numeral-conversion/#comments</comments>
		<pubDate>Thu, 21 May 2009 06:07:44 +0000</pubDate>
		<dc:creator>John</dc:creator>
				<category><![CDATA[C++]]></category>
		<category><![CDATA[Snippets]]></category>
		<category><![CDATA[cpp]]></category>
		<category><![CDATA[decimal]]></category>
		<category><![CDATA[roman numeral]]></category>

		<guid isPermaLink="false">http://www.johnciacia.com/?p=145</guid>
		<description><![CDATA[[code lang="cpp"]#include #include using namespace std; string dec_to_numeral(int x) { int dec[13] = {1000, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1}; string num[13] = {"M", "CM", "D", "CD", "C", "XC", "L", "XL", "X", "IX", "V", "IV", "I"}; string numeral; for(int i = 0; i < 13; i++) { while (x [...]]]></description>
			<content:encoded><![CDATA[<p>[code lang="cpp"]#include <iostream><br />
#include <string><br />
using namespace std;</p>
<p>string dec_to_numeral(int x) {<br />
    int dec[13] = {1000, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1};<br />
    string num[13] = {"M", "CM", "D", "CD", "C", "XC", "L", "XL", "X", "IX", "V", "IV", "I"};<br />
    string numeral;</p>
<p>    for(int i = 0; i < 13; i++) {<br />
        while (x >= dec[i]) {<br />
            x -= dec[i];<br />
            numeral.append(num[i]);<br />
        }<br />
    }</p>
<p>    return numeral;<br />
}</p>
<p>int main() {<br />
    //example<br />
    cout << dec_to_numeral(400);</p>
<p>    return 0;<br />
}[/code]</p>
]]></content:encoded>
			<wfw:commentRss>http://www.johnciacia.com/2009/05/21/decimal-to-roman-numeral-conversion/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Monte Carlo Generation of Pi</title>
		<link>http://www.johnciacia.com/2009/05/21/monte-carlo-generation-of-pi/</link>
		<comments>http://www.johnciacia.com/2009/05/21/monte-carlo-generation-of-pi/#comments</comments>
		<pubDate>Thu, 21 May 2009 05:34:44 +0000</pubDate>
		<dc:creator>John</dc:creator>
				<category><![CDATA[C++]]></category>
		<category><![CDATA[Snippets]]></category>
		<category><![CDATA[cpp]]></category>
		<category><![CDATA[monte carlo]]></category>
		<category><![CDATA[pi]]></category>

		<guid isPermaLink="false">http://www.johnciacia.com/?p=141</guid>
		<description><![CDATA[[code lang="cpp"]#include #include #include #include int main () { int in = 0; srand(time(NULL)); for(int i = 0; i < 1000000; i++) { float x = (rand()%1000000)/1000000.0; float y = (rand()%1000000)/1000000.0; double r = sqrt((pow(x,2)+pow(y,2))); if(r]]></description>
			<content:encoded><![CDATA[<p>[code lang="cpp"]#include <stdio.h><br />
#include <stdlib.h><br />
#include <time.h><br />
#include<br />
<math.h>
int main ()<br />
{<br />
    int in = 0;<br />
    srand(time(NULL));</p>
<p>    for(int i = 0; i < 1000000; i++) {<br />
        float x = (rand()%1000000)/1000000.0;<br />
        float y = (rand()%1000000)/1000000.0;<br />
        double r = sqrt((pow(x,2)+pow(y,2)));<br />
        if(r <= 1) in++;<br />
    }<br />
    printf("percent error=%fn", ((((4*in/1000000.0)-3.141592)/3.141592)*100));<br />
    printf("pi=%fn", (4*in/1000000.0));<br />
    return 0;<br />
}<br />
[/code]</p>
]]></content:encoded>
			<wfw:commentRss>http://www.johnciacia.com/2009/05/21/monte-carlo-generation-of-pi/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Page Caching using disk: enhanced

Served from: www.johnciacia.com @ 2012-02-05 10:32:57 -->
