<div dir="ltr">Hola Gery,<div class="gmail_extra"><br><div class="gmail_quote">2013/3/2 Gery . <span dir="ltr"><<a href="mailto:gamejihou@hotmail.com" target="_blank">gamejihou@hotmail.com</a>></span><br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">




<div><div dir="ltr"><font style="font-size:10pt" color="#366092" face="Arial">Hola Steven<font style="font-size:10pt"> y Salvador<font style="font-size:10pt">, y todos los usuarios de la lista<font style="font-size:10pt">:<br>

<br><font style="font-size:10pt"><font style="font-size:10pt"></font>So<font style="font-size:10pt">y <font style="font-size:10pt">nuevo por aqui enviando consultas a la l<font style="font-size:10pt">ista </font>y en general en el<font style="font-size:10pt"> mundo de la programacion en C++. Despues de probar <font style="font-size:10pt">varios ejemplo<font style="font-size:10pt">s en C++ durante<font style="font-size:10pt"> un tiempo, y le<font style="font-size:10pt">ido casi todo el <font style="font-size:10pt">excelente cur<font style="font-size:10pt">so que<font style="font-size:10pt"> </font>tienen</font></font></font></font></font></font></font></font></font></font></font></font></font></font>, he<font style="font-size:10pt"> comenzado a <font style="font-size:10pt">buscar la manera<font style="font-size:10pt"> de <font style="font-size:10pt">plotear mis resu<font style="font-size:10pt">ltados. </font></font></font></font></font><font style="font-size:10pt">Generalmente siempre he<font style="font-size:10pt"> usado shell y herramientas en linux para hacer mis calculos pero ahora lo estoy <font style="font-size:10pt">haciendo<font style="font-size:10pt"> con</font></font> C++. Empe<font style="font-size:10pt">ze con consol<font style="font-size:10pt">as </font><font style="font-size:10pt">win32</font></font> </font></font>pero tb estoy probando<font style="font-size:10pt"> con window forms.<font style="font-size:10pt"><br>

<br>Sobre el pr<font style="font-size:10pt">imer<font style="font-size:10pt">o tengo una duda que quizas me puedan a ayudar a enten<font style="font-size:10pt">der, dado que despues de varias semanas buscando en <font style="font-size:10pt">google no he<font style="font-size:10pt"> encontrado nada real<font style="font-size:10pt">mente claro. <font style="font-size:10pt">Lo que quiero es plotear datos X-<font style="font-size:10pt">Y despues <font style="font-size:10pt">de que mi programa termin<font style="font-size:10pt">e</font> de funci<font style="font-size:10pt">onar. Por </font></font></font></font></font></font></font></font></font></font></font></font></div>

</div></blockquote><div><br></div><div>[CORTE]</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<div><div dir="ltr"><font style="font-size:10pt" color="#1F497D" face="Arial"><font style="font-size:10pt">y quiero<font style="font-size:10pt"> que despues que d<font style="font-size:10pt">e</font> los resultados<font style="font-size:10pt">, esto es las do<font style="font-size:10pt">s co<font style="font-size:10pt">lumnas<font style="font-size:10pt"> "<font style="font-size:10pt">x" y "f(x)", aparezca un grafico p<font style="font-size:10pt">lo<font style="font-size:10pt">teando <font style="font-size:10pt">la<font style="font-size:10pt"> linea, como la figura adjunta. No quiero nada adornado, s<font style="font-size:10pt">olo<font style="font-size:10pt"> un grafico simple <font style="font-size:10pt">donde aparez<font style="font-size:10pt">ca la<font style="font-size:10pt"> linea.<font style="font-size:10pt"> Mi pregunta es <font style="font-size:10pt">s<font style="font-size:10pt">i se puede adicionar codigo al codigo <font style="font-size:10pt">de arriba para que genere <font style="font-size:10pt">ese grafico<font style="font-size:10pt"><font style="font-size:10pt">. En linux, <font style="font-size:10pt">yo corro el codigo de arriba con: c<font style="font-size:10pt">++</font> sin.cpp -o sin.exe<font style="font-size:10pt">.</font></font></font> Mi idea es <font style="font-size:10pt">que<font style="font-size:10pt"> al </font></font></font></font></font></font></font></font></font></font></font></font></font></font></font></font></font></font></font></font></font></font></font></font></font></div>

</div></blockquote><div><br></div><div>No hay nada en C/C++ ni en sus bibliotecas (estándares) para manipular gráficos; ni tampoco para otros temas, como música, sonido, telecomunicaciones, etc.. Por lo tanto, tienes que usar alguna biblioteca gráfica diseñada para tu plataforma y para el compilador que usas.</div>

<div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div><div dir="ltr"><font style="font-size:10pt" color="#1F497D" face="Arial"><font style="font-size:10pt"><font style="font-size:10pt"><font style="font-size:10pt"><font style="font-size:10pt"><font style="font-size:10pt"><font style="font-size:10pt"><font style="font-size:10pt"><font style="font-size:10pt"><font style="font-size:10pt"><font style="font-size:10pt"><font style="font-size:10pt"><font style="font-size:10pt"><font style="font-size:10pt"><font style="font-size:10pt"><font style="font-size:10pt"><font style="font-size:10pt"><font style="font-size:10pt"><font style="font-size:10pt"><font style="font-size:10pt"><font style="font-size:10pt"><font style="font-size:10pt"><font style="font-size:10pt"><font style="font-size:10pt"><font style="font-size:10pt">tener sin.cpp compilado (ie. sin.<font style="font-size:10pt">exe) </font>con el co<font style="font-size:10pt">digo<font style="font-size:10pt"> para <font style="font-size:10pt">plotear el X-Y</font>, pueda correr ese archivo en cualquier p<font style="font-size:10pt">c <font style="font-size:10pt">con linux<font style="font-size:10pt">. Se que puedo poner ese codigo en <font style="font-size:10pt">visual </font><font style="font-size:10pt">C++ y hacer un link a excel para plotear <font style="font-size:10pt">los resultad<font style="font-size:10pt">os, asi<font style="font-size:10pt"> como utilizar librerias externas al <font style="font-size:10pt">VC++, pero mi idea es que ese EXE no dep<font style="font-size:10pt">enda de eso.<font style="font-size:10pt"><br>

<br><font style="font-size:10pt">Tocando el mismo tema, pero yen<font style="font-size:10pt">do a<font style="font-size:10pt"> lo<font style="font-size:10pt"> que es windows form (que<font style="font-size:10pt"> probablement<font style="font-size:10pt">e estoy s<font style="font-size:10pt">ie<font style="font-size:10pt">ndo un poco "<font style="font-size:10pt">a<font style="font-size:10pt">nti C++" con esto ya que esos indi<font style="font-size:10pt">vidu<font style="font-size:10pt">os traba<font style="font-size:10pt">jan con C++/C<font style="font-size:10pt">LR), se <font style="font-size:10pt">que se pued<font style="font-size:10pt">e utilizar MSchart (que es un "plugin<font style="font-size:10pt">") </font>para graficar, pero he leido que esto genera u<font style="font-size:10pt">n prob<font style="font-size:10pt">lema al compilar y pasar el EXE <font style="font-size:10pt">entre pcs si es que no se tiene el .NET Framewok respectivo<font style="font-size:10pt"><font style="font-size:10pt"> (x lo que entiendo es <font style="font-size:10pt">q<font style="font-size:10pt">ue ese <font style="font-size:10pt">msc<font style="font-size:10pt">hart no <font style="font-size:10pt">forma parte del EXE<font style="font-size:10pt"><font style="font-size:10pt">)</font>, sa<font style="font-size:10pt">ben si </font></font></font></font></font></font></font></font></font></font></font></font></font></font></font></font></font></font></font></font></font></font></font></font></font></font></font></font></font></font></font></font></font></font></font></font></font></font></font></font></font></font></font></font></font></font></font></font></font></font></font></font></font></font></font></font></font></font></font></font></font></font></font></font></font><font style="font-size:10pt">eso es cor<font style="font-size:10pt">re<font style="font-size:10pt">cto?<br>

<br></font></font></font></div></div></blockquote><div><br></div><div style>Se trata de un control ActiveX, que ahora también aparece en .NET. El armazón de .NET ya es accesible en cualquier PC que tenga MS-Windows, así que no deberías tener muchos problemas, si quieres usar .NET, lo cual requiere otra forma de preparar tu programa para que funcione.</div>
<div style><br></div><div style>La otra opción es cargando el control ActiveX, pero eso requiere manejar controles OLE/COM, y usar sus bibliotecas, que también requiere usar su forma de hacer las cosas, pero pienso que no es tan "problemático" comparado con .NET.</div>
<div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div><div dir="ltr"><font style="font-size:10pt"><font style="font-size:10pt"><font style="font-size:10pt"><font style="font-size:10pt">Finalmente (disculpen por el l<font style="font-size:10pt">argo correo), se que consolas win32 es simple que e<font style="font-size:10pt">l AP<font style="font-size:10pt">I </font></font>win<font style="font-size:10pt">32<font style="font-size:10pt">, he<font style="font-size:10pt"> "hoj<font style="font-size:10pt">eado" <font style="font-size:10pt">el<font style="font-size:10pt"> curso<font style="font-size:10pt"> que tienen</font> de este ultimo (ya que son mas de 2000 paginas<font style="font-size:10pt">!), y no he podi<font style="font-size:10pt">do bajar <font style="font-size:10pt">los<font style="font-size:10pt"> ejemplos que tienen ya que ocurre u<font style="font-size:10pt">n problema, pero qu<font style="font-size:10pt">i<font style="font-size:10pt">siera sa<font style="font-size:10pt">ber si en <font style="font-size:10pt">el caso no se pueda hacer lo<font style="font-size:10pt">s graficos <font style="font-size:10pt"><font style="font-size:10pt">X-<font style="font-size:10pt">Y </font></font>con consola win32 de la forma que quiero, est<font style="font-size:10pt">o se podria hacer con el <font style="font-size:10pt">API win32.<br>

<br></font></font></font></font></font></font></font></font></font></font></font></font></font></font></font></font></font></font></font></font></font></font></font></font></div></div></blockquote><div><br></div><div style>
La consola es sólo para texto y no tiene prestaciones avanzadas para gráficos. Si quieres dibujar, entonces necesitas crear una ventana en la que poder dibujar con las funciones de la GDI. Puedes dirigirte al capítulo 16 de nuestro curso del API de MS-Windows, yendo a: <a href="http://winapi.conclase.net/curso/index.php?cap=016#inicio">http://winapi.conclase.net/curso/index.php?cap=016#inicio</a></div>
<div><br></div><div style>Tienes un error en tu código fuente. Escribes:<br><br><pre style="white-space:pre-wrap"><code>for( unsigned i=0; i<=Nplot; i++ )</code></pre>Esto implica que 'i' va de 0 á 100, resultando en 101 muestras. Sin embargo, 'Nplot' sugiere que representa la cantidad total de muestras. Por lo tanto, deberíamos ir de 0 á 99; esto es,</div>
<div style><br></div><div style><span style="white-space:pre-wrap">for( </span><span style="white-space:pre-wrap">unsigned</span><span style="white-space:pre-wrap"> i</span><span style="white-space:pre-wrap">=</span><span style="white-space:pre-wrap">0</span><span style="white-space:pre-wrap">; </span><span style="white-space:pre-wrap">i</span><span style="white-space:pre-wrap"><</span><span style="white-space:pre-wrap">Nplot</span><span style="white-space:pre-wrap">; </span><span style="white-space:pre-wrap">i</span><span style="white-space:pre-wrap">++ )</span></div>
<div style><br></div><div style>Cuando muestres la gráfica, tienes que tomar en cuenta que el sistema de coordenadas, que usa las matemáticas, es diferente al de la ventana. Aparte de la diferencia entre las unidades de cada dimensión, el sentido positivo del eje Y del sistema cartesiano es diferente al de la ventana, que típicamente va hacia abajo. Para más información, puedes consultar el capítulo 2 de nuestro curso de gráficos, yendo a: <a href="http://graficos.conclase.net/curso/index.php?cap=002#inicio">http://graficos.conclase.net/curso/index.php?cap=002#inicio</a></div>
<div><br></div><div style>Si vas a usar la GDI, entonces puedes indicar a tu ventana el origen, la vista, y el modo de "mapeo" que quieres, para que así automáticamente se ajuste al sistema cartesiano. Puedes consultar el capítulo 28 de nuestro curso del API de MS-Windows; puedes ir a: <a href="http://winapi.conclase.net/curso/index.php?cap=028#028_VENTANAS">http://winapi.conclase.net/curso/index.php?cap=028#028_VENTANAS</a></div>
<div><br></div><div><br></div><div style>Espero que esto te oriente.</div><div><br></div><div style>Steven</div><div style><br></div></div></div></div>