{"id":153,"date":"2014-02-26T12:24:58","date_gmt":"2014-02-26T12:30:45","guid":{"rendered":"https:\/\/3e44977F.jpg"},"modified":"2015-07-16T20:47:38","modified_gmt":"2015-07-17T02:47:38","slug":"ordenar-numeros-de-manera-ascendente-y-descendente-con-c","status":"publish","type":"post","link":"https:\/\/emanuelpaxtian.com\/blog\/ordenar-numeros-de-manera-ascendente-y-descendente-con-c\/","title":{"rendered":"Ordenar Numeros de manera Ascendente y Descendente con c++"},"content":{"rendered":"<p>El siguiente codigo ordena una cantidad de numeros introducida por el usuario y luego los ordena de forma ascendente y descentente y al final la imprime por pantalla<\/p>\n<pre class=\"brush: cpp\">#include &lt; conio.h &gt; \r\n#include &lt; stdio.h &gt; \r\n#include &lt; iostream &gt;\r\n\r\nmain() {\r\n    int n, i, j, A[50], aux;\r\n\r\n    cout &lt;&lt; \"Ingrese la Cantidad de Nuemeros a Ingresar: \";\r\n    cin &gt;&gt; n;\r\n    \/\/llenamos el vector\r\n    for (i = 1; i &lt;= n; i++) {\r\n        cout &lt;&lt; \"Vector Numero \" &lt;&lt; i &lt;&lt; \" :\";\r\n        cin &gt;&gt; A[i];\r\n    }\r\n    \/\/se realiza la ordenacion de los numeros\r\n    for (i = 1; i &lt;= n - 1; i++) {\r\n        for (j = 1; j &lt;= n - 1; j++) {\r\n            if (A[j] &gt; A[j + 1]) {\r\n                aux = A[j];\r\n                A[j] = A[j + 1];\r\n                A[j + 1] = aux;\r\n            }\r\n        }\r\n    }\r\n    \/\/se imprimen los numeros\r\n    cout &lt;&lt; \"ascendente: \";\r\n    for (i = 1; i &lt;= n; i++) {\r\n        cout &lt;&lt; \",\" &lt;&lt; A[i];\r\n    }\r\n    cout &lt;&lt; \"ndecendente: \";\r\n    for (i = n; i &gt;= 1; i--) {\r\n        cout &lt;&lt; \",\" &lt;&lt; A[i];\r\n    }\r\n    getch();\r\n}<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>El siguiente codigo ordena una cantidad de numeros introducida por el usuario y luego los ordena de forma ascendente y descentente y al final la imprime por pantalla #include &lt;&hellip;<\/p>\n","protected":false},"author":1,"featured_media":365,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[],"class_list":["post-153","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-general"],"_links":{"self":[{"href":"https:\/\/emanuelpaxtian.com\/blog\/wp-json\/wp\/v2\/posts\/153","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/emanuelpaxtian.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/emanuelpaxtian.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/emanuelpaxtian.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/emanuelpaxtian.com\/blog\/wp-json\/wp\/v2\/comments?post=153"}],"version-history":[{"count":0,"href":"https:\/\/emanuelpaxtian.com\/blog\/wp-json\/wp\/v2\/posts\/153\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/emanuelpaxtian.com\/blog\/wp-json\/wp\/v2\/media\/365"}],"wp:attachment":[{"href":"https:\/\/emanuelpaxtian.com\/blog\/wp-json\/wp\/v2\/media?parent=153"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/emanuelpaxtian.com\/blog\/wp-json\/wp\/v2\/categories?post=153"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/emanuelpaxtian.com\/blog\/wp-json\/wp\/v2\/tags?post=153"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}