<?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>Hyperthèse &#187; D</title>
	<atom:link href="http://hyperthese.net/category/programmation/d/feed/" rel="self" type="application/rss+xml" />
	<link>http://hyperthese.net</link>
	<description>La connaissance supposée fausse</description>
	<lastBuildDate>Mon, 14 Jun 2010 17:32:36 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Verrification de code EAN8/13 en D</title>
		<link>http://hyperthese.net/verrification-de-code-ean813-en-d/</link>
		<comments>http://hyperthese.net/verrification-de-code-ean813-en-d/#comments</comments>
		<pubDate>Thu, 06 Mar 2008 21:26:15 +0000</pubDate>
		<dc:creator>Rémy Sanchez</dc:creator>
				<category><![CDATA[D]]></category>
		<category><![CDATA[Programmation]]></category>

		<guid isPermaLink="false">http://hyperthese.net/verrification-de-code-ean813-en-d/</guid>
		<description><![CDATA[Voici une fonction écrite en D qui dit si oui ou non la chaine soumise en entrée est un code EAN correct : on verrifie le nombre de caractères, que tout les caractères sont bien des chiffres, et on regarde que la checksumm est bien la bonne.
PLAIN TEXT
C:




bool eanCheck&#40;string ean&#41; &#123;


&#160; &#160; int summ = [...]]]></description>
			<content:encoded><![CDATA[<p>Voici une fonction écrite en D qui dit si oui ou non la chaine soumise en entrée est un code EAN correct : on verrifie le nombre de caractères, que tout les caractères sont bien des chiffres, et on regarde que la checksumm est bien la bonne.</p>
<div class="igBar"><span id="lc-2"><a href="http://hyperthese.net/wp-content/plugins/feed-statistics.php?url=Iw==" onclick=\"javascript:showCodeTxt('c-2'); return false;\">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">C:</span>
<div id="c-2">
<div class="c">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">bool eanCheck<span style="color: #66cc66;">&#40;</span><span style="color: #993333;">string</span> ean<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #993333;">int</span> summ = <span style="color: #cc66cc;color:#800000;">0</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; </div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span>ean.<span style="color: #202020;">length</span> != <span style="color: #cc66cc;color:#800000;">13</span> &amp;&amp; ean.<span style="color: #202020;">length</span> !=<span style="color: #cc66cc;color:#800000;">8</span><span style="color: #66cc66;">&#41;</span> <span style="color: #b1b100;">return</span> <span style="color: #000000; font-weight: bold;">false</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; </div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #993333;">int</span> n = ean.<span style="color: #202020;">length</span> - <span style="color: #cc66cc;color:#800000;">1</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #b1b100;">for</span><span style="color: #66cc66;">&#40;</span><span style="color: #993333;">int</span> i=<span style="color: #cc66cc;color:#800000;">0</span>; i&lt;n; i+=<span style="color: #cc66cc;color:#800000;">2</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>ean<span style="color: #66cc66;">&#91;</span>i<span style="color: #66cc66;">&#93;</span> &lt;<span style="color: #cc66cc;color:#800000;">48</span> || ean<span style="color: #66cc66;">&#91;</span>i<span style="color: #66cc66;">&#93;</span>&gt; <span style="color: #cc66cc;color:#800000;">57</span><span style="color: #66cc66;">&#41;</span> <span style="color: #b1b100;">return</span> <span style="color: #000000; font-weight: bold;">false</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; summ += ean<span style="color: #66cc66;">&#91;</span>i<span style="color: #66cc66;">&#93;</span> - <span style="color: #cc66cc;color:#800000;">48</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #b1b100;">for</span><span style="color: #66cc66;">&#40;</span><span style="color: #993333;">int</span> i=<span style="color: #cc66cc;color:#800000;">1</span>; i&lt;n; i+=<span style="color: #cc66cc;color:#800000;">2</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>ean<span style="color: #66cc66;">&#91;</span>i<span style="color: #66cc66;">&#93;</span> &lt;<span style="color: #cc66cc;color:#800000;">48</span> || ean<span style="color: #66cc66;">&#91;</span>i<span style="color: #66cc66;">&#93;</span>&gt; <span style="color: #cc66cc;color:#800000;">57</span><span style="color: #66cc66;">&#41;</span> <span style="color: #b1b100;">return</span> <span style="color: #000000; font-weight: bold;">false</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; summ += <span style="color: #cc66cc;color:#800000;">3</span> * <span style="color: #66cc66;">&#40;</span>ean<span style="color: #66cc66;">&#91;</span>i<span style="color: #66cc66;">&#93;</span> - <span style="color: #cc66cc;color:#800000;">48</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; </div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; summ = <span style="color: #cc66cc;color:#800000;">10</span> - <span style="color: #66cc66;">&#40;</span>summ % <span style="color: #cc66cc;color:#800000;">10</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; </div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>summ == ean<span style="color: #66cc66;">&#91;</span>n<span style="color: #66cc66;">&#93;</span> - <span style="color: #cc66cc;color:#800000;">48</span><span style="color: #66cc66;">&#41;</span> <span style="color: #b1b100;">return</span> <span style="color: #000000; font-weight: bold;">true</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #b1b100;">else</span> <span style="color: #b1b100;">return</span> <span style="color: #000000; font-weight: bold;">false</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Note: pour fonctionner, ce programme requiet une entrée dans un charset compatible ASCII (iso-8859-* ou utf-8 par exemple)</p>
 <img src="http://hyperthese.net/wp-content/plugins/feed-statistics.php?view=1&post_id=101" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://hyperthese.net/verrification-de-code-ean813-en-d/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
