hello, i need help with this. i have to create a program that sort data as follow: if a entry pair data don,t touch the list but if a entry a impair data i have to put 3 dates with the value of 999, continue with the first list i have to organize from low to high, when i meeting the first number this number in the firt list, his value become in 999 and i have to continue operate with the same until finished, i hope can help me
this is my idea:
#include "stdafx.h"
#include <iostream>
#include "conio.h"
#include <math.h>
using namespace System;
using namespace std;
int main() {
int n,i,p,c,f,o,q, j,h, x,a[10][10],div, rest;
cout << "Ingrese la cantidad de datos que desea organizar: ";
cin >> n;
for (i = 1; i <= n; i = i + 1) {
cout << "ingrese el " << i << " dato que desea organizar: "; cin >> a[i][1];
}
//aquí se sabe si es par o impar
div = n / 2;
rest = n - div * 2;
h = n;
if (rest != 0) {
h = n + 3;
for (i = n; i <= h; i = i + 1) {
a[i][1] = 999;
}
}
c = 6;
for(x=1; x<=n; x=x+1){//1.2.3.4.5
for (j = 1; j <=n-1; j = j + 1) {//1.2.3.4.5
for(p=1;p<=c-1;p=p+1){//1.2.3.4.5-1.2.3.4--1.2.3-1.2--1
for (i = 1; i <= n + 1 - j; i = i + 1) {//1.2.3.4.5.6-1.2.3.4.5-1.2.3.4-1.2.3-1.2
if (x > 1) {
if (a[1][x+n-1] = a[i][1]) {
a[i][1] = 999;
}
}
if (a[i][j] < a[i + 1][j]) {
a[p][j + x ] == a[i][j];
}
else {
a[p][j + 1] == a[i + 1][j];
}
cout << a[p][j + x];
}
}
}
c = c - 1;//5.4.3.2
f = 0;
cout << (2 * h - 1);
}for (o = 1; o <= 2 * h - 1; o = o + 1) {
for (q = 1; q <= h-f; q = q + 1) {
cout << " "<< a[q][o];
}
cout << endl;
c = h - f;
if (c< 1) {
f = f + 1;
This is the code that i have now i can´t with the sort
#include "stdafx.h"
#include <iostream>
#include "conio.h"
#include <math.h>
using namespace System;
using namespace std;
int main() {
int n,i,p,c,f,u,o,k,q, j,h, x,a[10][10],div, rest;
cout << "Ingrese la cantidad de datos que desea organizar: ";
cin >> n;
for (i = 1; i <= n; i = i + 1) {
cout << "ingrese el " << i << " dato que desea organizar: "; cin >> a[i][1];
}
//aquí se sabe si es par o impar
div = n / 2;
rest = n - div * 2;
h = n;
if (rest != 0) {
h = n + 3;
for (i = n+1; i <= h; i = i + 1) {
a[i][1] = 999;
}
}//todo bien
c=h;
for(x=1; x<=h; x=x+1){//1.2.3.4.5
for (j = 1; j <= h - 1; j = j + 1) {//1.2.3.4.5
for (i = 1; i <= n+1 - j; i = i + 1) {//1.2.3.4.5.6-1.2.3.4.5-1.2.3.4-1.2.3-1.2
if (x >= 2) {
if (a[1][x + n - 1] = a[i][1]) {
a[i][1] = 999;
}
}
if (a[i][j] <= a[i + 1][j]) {
a[i][j + 1] == a[i][j];
}
else {
a[i][j + 1] == a[i + 1][j];
}
}
a[1][j + x + 1] = a[i][j + 1];
c = c - 1;//5.4.3.2
}
}
f = 0;
k = 2 * h - 1;
u = 0;
for (o = 1; o <= k; o = o + 1) {
u = h - f;
for (q = 1; q <= u; q = q + 1) {
cout <<a[q][o]<<" ";
}
cout <<endl;
if (u>1) {
f = f + 1;
}
}
getch();
}
#include "stdafx.h"
#include <iostream>
#include "conio.h"
#include <math.h>
using namespace System;
using namespace std;
int main() {
int n,i,p,c,f,u,o,aux,k,q, j,h, x,a[10][10],div, rest;
cout << "Ingrese la cantidad de datos que desea organizar: ";
cin >> n;
for (i = 1; i <= n; i = i + 1) {
cout << "ingrese el " << i << " dato que desea organizar: "; cin >> a[i][1];
}
//aquí se sabe si es par o impar
div = n / 2;
rest = n - div * 2;
h = n;
if (rest != 0) {
h = n + 3;
for (i = n+1; i <= h; i = i + 1) {
a[i][1] = 999;
}
}//todo bien
for(x=1; x<=h; x=x+1){//1.2.3.4.5
for (j = 1; j <= h - 1; j = j + 1) {//1.2.3.4.5
for (i = 1; i <= h- j; i = i + 1) {//1.2.3.4.5.6-1.2.3.4.5-1.2.3.4-1.2.3-1.2
if (a[i][j] < a[i + 1][j]) {
a[i][j + 1] == a[i][j];
aux = a[i][j + 1];
}
else {
a[i][j + 1] == a[i + 1][j];
aux = a[i][j + 1];
}
}
}
a[1][n + x] = aux;
}
f = 0;
k = 2 * h - 1;
u = 0;
for (j = 1; j <= k; j = j + 1) {
u = h - f;
for (i = 1; i <= u; i = i + 1) {
cout <<a[i][j]<<" ";
}
cout <<endl;
if (u>1) {
f = f + 1;
}
}
getch();
}
> this is my idea
no, esa es tu porquería de implementación
describí tu idea usando pseudocódigo, un diagrama de flujo u oraciones
---
no, that's your poor implementation
express your idea with pseudocode, a flow diagram or sentences.
> when i meeting the first number this number in the firt list, his value
> become in 999 and i have to continue operate with the same until finished
no se entiende ni jota
---
don't understand
y por si no te enteraste, estás en un foro de programación.
tendría que haber herramientas que conserven, al menos, la indentación del código
---
please use code tags