<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>Comentarios en: Ejercicios de array con C# (3ra. parte)</title>
	<atom:link href="http://www.puntopeek.com/codigos-c/ejercicios-resueltos-de-c-3ra-parte/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.puntopeek.com/codigos-c/ejercicios-resueltos-de-c-3ra-parte/</link>
	<description>Programación en C#, PHP y software libre</description>
	<lastBuildDate>Mon, 06 Sep 2010 01:57:59 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>Por: Maria Eliza</title>
		<link>http://www.puntopeek.com/codigos-c/ejercicios-resueltos-de-c-3ra-parte/comment-page-1/#comment-208</link>
		<dc:creator>Maria Eliza</dc:creator>
		<pubDate>Sat, 05 Jun 2010 03:14:44 +0000</pubDate>
		<guid isPermaLink="false">http://www.puntopeek.com/?p=158#comment-208</guid>
		<description>hola, gracias por la ayuda anterior, quisiera saber si me pueden enviar una idea de como comprimir un archivo, gracias</description>
		<content:encoded><![CDATA[<p>hola, gracias por la ayuda anterior, quisiera saber si me pueden enviar una idea de como comprimir un archivo, gracias</p>
]]></content:encoded>
	</item>
	<item>
		<title>Por: Tomy</title>
		<link>http://www.puntopeek.com/codigos-c/ejercicios-resueltos-de-c-3ra-parte/comment-page-1/#comment-201</link>
		<dc:creator>Tomy</dc:creator>
		<pubDate>Wed, 26 May 2010 20:35:35 +0000</pubDate>
		<guid isPermaLink="false">http://www.puntopeek.com/?p=158#comment-201</guid>
		<description>percy1006--&gt; aqui te pongo como ver si un array a esta contenido dentro de otro. El codigo seria algo asi, hay mejores formas de hacerlo, pero lo hice de la forma mas basica para que todos entendieran.
&lt;pre lang=&quot;csharp&quot;&gt;
static void Main(string[] args)
        {
            List&lt;string&gt; list = new List&lt;string&gt;();

            int[] a = { 4, 6, 3, 1, 6, 8, 4, 2, 5, 78, 3 };
            int[] b = { 4, 6, 3, 1, 6, 7, 9, 11 };
            Console.WriteLine(EstaContenido(a, b));
            Console.ReadLine();
        }

        //Queremos saber si b está contenido en a
        static bool EstaContenido(int[] a, int[] b)
        {
            int count =0;
            //Si b es mayor que a no tiene logica ver si esta contenido
            if (b.Length &gt; a.Length)
                return false;
            else
                for (int i = 0; i &lt; a.Length; i++)
                {
                    //Si coinciden los dos primeros y no me salgo del array
                    if (a[i] == b[0] &amp;&amp; i+b.Length&lt;a.Length)
                        //Recorro el array b para ver si esta contenido completamente en a;
                        for (int j = 1; j &lt; b.Length; j++)
                            if (a[i+j] == b[j])
                                count++;
                    //La variable count me dice si todos los elementos de b estan en a
                    if (count == b.Length - 1)
                        return true;
                    else
                        count = 0;
                }
            return false;
        }
&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<p>percy1006&#8211;> aqui te pongo como ver si un array a esta contenido dentro de otro. El codigo seria algo asi, hay mejores formas de hacerlo, pero lo hice de la forma mas basica para que todos entendieran.</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #0600FF;">static</span> <span style="color: #0600FF;">void</span> Main<span style="color: #000000;">&#40;</span><span style="color: #FF0000;">string</span><span style="color: #000000;">&#91;</span><span style="color: #000000;">&#93;</span> args<span style="color: #000000;">&#41;</span>
        <span style="color: #000000;">&#123;</span>
            List<span style="color: #008000;">&lt;</span><span style="color: #FF0000;">string</span><span style="color: #008000;">&gt;</span> list <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> List<span style="color: #008000;">&lt;</span><span style="color: #FF0000;">string</span><span style="color: #008000;">&gt;</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
            <span style="color: #FF0000;">int</span><span style="color: #000000;">&#91;</span><span style="color: #000000;">&#93;</span> a <span style="color: #008000;">=</span> <span style="color: #000000;">&#123;</span> <span style="color: #FF0000;">4</span>, <span style="color: #FF0000;">6</span>, <span style="color: #FF0000;">3</span>, <span style="color: #FF0000;">1</span>, <span style="color: #FF0000;">6</span>, <span style="color: #FF0000;">8</span>, <span style="color: #FF0000;">4</span>, <span style="color: #FF0000;">2</span>, <span style="color: #FF0000;">5</span>, <span style="color: #FF0000;">78</span>, <span style="color: #FF0000;">3</span> <span style="color: #000000;">&#125;</span><span style="color: #008000;">;</span>
            <span style="color: #FF0000;">int</span><span style="color: #000000;">&#91;</span><span style="color: #000000;">&#93;</span> b <span style="color: #008000;">=</span> <span style="color: #000000;">&#123;</span> <span style="color: #FF0000;">4</span>, <span style="color: #FF0000;">6</span>, <span style="color: #FF0000;">3</span>, <span style="color: #FF0000;">1</span>, <span style="color: #FF0000;">6</span>, <span style="color: #FF0000;">7</span>, <span style="color: #FF0000;">9</span>, <span style="color: #FF0000;">11</span> <span style="color: #000000;">&#125;</span><span style="color: #008000;">;</span>
            Console.<span style="color: #0000FF;">WriteLine</span><span style="color: #000000;">&#40;</span>EstaContenido<span style="color: #000000;">&#40;</span>a, b<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
            Console.<span style="color: #0000FF;">ReadLine</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
        <span style="color: #000000;">&#125;</span>
&nbsp;
        <span style="color: #008080; font-style: italic;">//Queremos saber si b está contenido en a</span>
        <span style="color: #0600FF;">static</span> <span style="color: #FF0000;">bool</span> EstaContenido<span style="color: #000000;">&#40;</span><span style="color: #FF0000;">int</span><span style="color: #000000;">&#91;</span><span style="color: #000000;">&#93;</span> a, <span style="color: #FF0000;">int</span><span style="color: #000000;">&#91;</span><span style="color: #000000;">&#93;</span> b<span style="color: #000000;">&#41;</span>
        <span style="color: #000000;">&#123;</span>
            <span style="color: #FF0000;">int</span> count <span style="color: #008000;">=</span><span style="color: #FF0000;">0</span><span style="color: #008000;">;</span>
            <span style="color: #008080; font-style: italic;">//Si b es mayor que a no tiene logica ver si esta contenido</span>
            <span style="color: #0600FF;">if</span> <span style="color: #000000;">&#40;</span>b.<span style="color: #0000FF;">Length</span> <span style="color: #008000;">&gt;</span> a.<span style="color: #0000FF;">Length</span><span style="color: #000000;">&#41;</span>
                <span style="color: #0600FF;">return</span> false<span style="color: #008000;">;</span>
            <span style="color: #0600FF;">else</span>
                <span style="color: #0600FF;">for</span> <span style="color: #000000;">&#40;</span><span style="color: #FF0000;">int</span> i <span style="color: #008000;">=</span> <span style="color: #FF0000;">0</span><span style="color: #008000;">;</span> i <span style="color: #008000;">&lt;</span> a.<span style="color: #0000FF;">Length</span><span style="color: #008000;">;</span> i<span style="color: #008000;">++</span><span style="color: #000000;">&#41;</span>
                <span style="color: #000000;">&#123;</span>
                    <span style="color: #008080; font-style: italic;">//Si coinciden los dos primeros y no me salgo del array</span>
                    <span style="color: #0600FF;">if</span> <span style="color: #000000;">&#40;</span>a<span style="color: #000000;">&#91;</span>i<span style="color: #000000;">&#93;</span> <span style="color: #008000;">==</span> b<span style="color: #000000;">&#91;</span><span style="color: #FF0000;">0</span><span style="color: #000000;">&#93;</span> <span style="color: #008000;">&amp;&amp;</span> i<span style="color: #008000;">+</span>b.<span style="color: #0000FF;">Length</span><span style="color: #008000;">&lt;</span>a.<span style="color: #0000FF;">Length</span><span style="color: #000000;">&#41;</span>
                        <span style="color: #008080; font-style: italic;">//Recorro el array b para ver si esta contenido completamente en a;</span>
                        <span style="color: #0600FF;">for</span> <span style="color: #000000;">&#40;</span><span style="color: #FF0000;">int</span> j <span style="color: #008000;">=</span> <span style="color: #FF0000;">1</span><span style="color: #008000;">;</span> j <span style="color: #008000;">&lt;</span> b.<span style="color: #0000FF;">Length</span><span style="color: #008000;">;</span> j<span style="color: #008000;">++</span><span style="color: #000000;">&#41;</span>
                            <span style="color: #0600FF;">if</span> <span style="color: #000000;">&#40;</span>a<span style="color: #000000;">&#91;</span>i<span style="color: #008000;">+</span>j<span style="color: #000000;">&#93;</span> <span style="color: #008000;">==</span> b<span style="color: #000000;">&#91;</span>j<span style="color: #000000;">&#93;</span><span style="color: #000000;">&#41;</span>
                                count<span style="color: #008000;">++;</span>
                    <span style="color: #008080; font-style: italic;">//La variable count me dice si todos los elementos de b estan en a</span>
                    <span style="color: #0600FF;">if</span> <span style="color: #000000;">&#40;</span>count <span style="color: #008000;">==</span> b.<span style="color: #0000FF;">Length</span> <span style="color: #008000;">-</span> <span style="color: #FF0000;">1</span><span style="color: #000000;">&#41;</span>
                        <span style="color: #0600FF;">return</span> true<span style="color: #008000;">;</span>
                    <span style="color: #0600FF;">else</span>
                        count <span style="color: #008000;">=</span> <span style="color: #FF0000;">0</span><span style="color: #008000;">;</span>
                <span style="color: #000000;">&#125;</span>
            <span style="color: #0600FF;">return</span> false<span style="color: #008000;">;</span>
        <span style="color: #000000;">&#125;</span></pre></div></div>

]]></content:encoded>
	</item>
	<item>
		<title>Por: Tomy</title>
		<link>http://www.puntopeek.com/codigos-c/ejercicios-resueltos-de-c-3ra-parte/comment-page-1/#comment-200</link>
		<dc:creator>Tomy</dc:creator>
		<pubDate>Wed, 26 May 2010 20:21:27 +0000</pubDate>
		<guid isPermaLink="false">http://www.puntopeek.com/?p=158#comment-200</guid>
		<description>Maria Eliza--&gt; 
declarar un arreglo de string con los meses del año:
&lt;pre lang=&quot;csharp&quot;&gt;
string[] meses = new string[]
{
enero, febrero, marzo, abril, mayo, junio, julio, agosto, septiembre, octubre, noviembre, diciembre
};&lt;/pre&gt;

declarar un enum con los meses del año:
&lt;pre lang=&quot;csharp&quot;&gt;
enum meses {
enero, febrero, marzo, abril, mayo, junio, julio, agosto, septiembre, octubre, noviembre, diciembre
};
&lt;/pre&gt;
la diferencia está a la hora de acceder a los meses. 

En enum:
meses. Enero=1;

En arrays:
string febrero = meses[1];</description>
		<content:encoded><![CDATA[<p>Maria Eliza&#8211;><br />
declarar un arreglo de string con los meses del año:</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #FF0000;">string</span><span style="color: #000000;">&#91;</span><span style="color: #000000;">&#93;</span> meses <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> <span style="color: #FF0000;">string</span><span style="color: #000000;">&#91;</span><span style="color: #000000;">&#93;</span>
<span style="color: #000000;">&#123;</span>
enero, febrero, marzo, abril, mayo, junio, julio, agosto, septiembre, octubre, noviembre, diciembre
<span style="color: #000000;">&#125;</span><span style="color: #008000;">;</span></pre></div></div>

<p>declarar un enum con los meses del año:</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #FF0000;">enum</span> meses <span style="color: #000000;">&#123;</span>
enero, febrero, marzo, abril, mayo, junio, julio, agosto, septiembre, octubre, noviembre, diciembre
<span style="color: #000000;">&#125;</span><span style="color: #008000;">;</span></pre></div></div>

<p>la diferencia está a la hora de acceder a los meses. </p>
<p>En enum:<br />
meses. Enero=1;</p>
<p>En arrays:<br />
string febrero = meses[1];</p>
]]></content:encoded>
	</item>
	<item>
		<title>Por: Maria Eliza</title>
		<link>http://www.puntopeek.com/codigos-c/ejercicios-resueltos-de-c-3ra-parte/comment-page-1/#comment-191</link>
		<dc:creator>Maria Eliza</dc:creator>
		<pubDate>Thu, 13 May 2010 21:30:38 +0000</pubDate>
		<guid isPermaLink="false">http://www.puntopeek.com/?p=158#comment-191</guid>
		<description>Hola quisiera saber como puedo declarar un arreglo tipo string con el nombre de los meses y luego ese mismo arreglo utilizando enum</description>
		<content:encoded><![CDATA[<p>Hola quisiera saber como puedo declarar un arreglo tipo string con el nombre de los meses y luego ese mismo arreglo utilizando enum</p>
]]></content:encoded>
	</item>
	<item>
		<title>Por: Tomy</title>
		<link>http://www.puntopeek.com/codigos-c/ejercicios-resueltos-de-c-3ra-parte/comment-page-1/#comment-168</link>
		<dc:creator>Tomy</dc:creator>
		<pubDate>Wed, 17 Mar 2010 05:06:49 +0000</pubDate>
		<guid isPermaLink="false">http://www.puntopeek.com/?p=158#comment-168</guid>
		<description>Hello Simi, You&#039;re absolutely right. http://www.csharptalk.com is a good C# resource. They/You have a lot of tutorials and examples.</description>
		<content:encoded><![CDATA[<p>Hello Simi, You&#8217;re absolutely right. <a href="http://www.csharptalk.com" rel="nofollow">http://www.csharptalk.com</a> is a good C# resource. They/You have a lot of tutorials and examples.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Por: simi</title>
		<link>http://www.puntopeek.com/codigos-c/ejercicios-resueltos-de-c-3ra-parte/comment-page-1/#comment-153</link>
		<dc:creator>simi</dc:creator>
		<pubDate>Wed, 30 Dec 2009 08:26:31 +0000</pubDate>
		<guid isPermaLink="false">http://www.puntopeek.com/?p=158#comment-153</guid>
		<description>hi,

First of all. Thanks very much for your useful post.

I just came across your blog and wanted to drop you a note telling you how impressed I was with the information you have posted here.

Please let me introduce you some info related to this post and I hope that it is useful for .Net community.

There is a good C# resource site, Have alook
 
http://www.csharptalk.com/2009/09/c-array.html
http://www.csharptalk.com/2009/10/creating-arrays.html

simi</description>
		<content:encoded><![CDATA[<p>hi,</p>
<p>First of all. Thanks very much for your useful post.</p>
<p>I just came across your blog and wanted to drop you a note telling you how impressed I was with the information you have posted here.</p>
<p>Please let me introduce you some info related to this post and I hope that it is useful for .Net community.</p>
<p>There is a good C# resource site, Have alook</p>
<p><a href="http://www.csharptalk.com/2009/09/c-array.html" rel="nofollow">http://www.csharptalk.com/2009/09/c-array.html</a><br />
<a href="http://www.csharptalk.com/2009/10/creating-arrays.html" rel="nofollow">http://www.csharptalk.com/2009/10/creating-arrays.html</a></p>
<p>simi</p>
]]></content:encoded>
	</item>
	<item>
		<title>Por: percy1006</title>
		<link>http://www.puntopeek.com/codigos-c/ejercicios-resueltos-de-c-3ra-parte/comment-page-1/#comment-152</link>
		<dc:creator>percy1006</dc:creator>
		<pubDate>Wed, 09 Dec 2009 17:38:10 +0000</pubDate>
		<guid isPermaLink="false">http://www.puntopeek.com/?p=158#comment-152</guid>
		<description>alqguien me puede decir como hacer un metodo para comparar dos arrays ejemplo A=[2,5,6,7,8,11,35] B=[1,4,7,30]
Saber si B esta contenido en A</description>
		<content:encoded><![CDATA[<p>alqguien me puede decir como hacer un metodo para comparar dos arrays ejemplo A=[2,5,6,7,8,11,35] B=[1,4,7,30]<br />
Saber si B esta contenido en A</p>
]]></content:encoded>
	</item>
</channel>
</rss>

<!-- Dynamic Page Served (once) in 1.067 seconds -->
