Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 27 additions & 3 deletions ejercicio1/intercambio.c
Original file line number Diff line number Diff line change
@@ -1,3 +1,27 @@
#include "intercambio.h"

//Escriba aquí su código!
#include "intercambio.h"

void intercambio(int* pi1, int* pi2){

int aux;
aux = *pi1;
*pi1 = *pi2;
*pi2 = aux;
}

void ordenarEnteros(int viEnteros[], int iCantidad){
int aux, band=0, i;

while(!band){
band=1;
for(i=0;i<iCantidad;i++){
if(viEnteros[i]>viEnteros[i+1]){
aux=viEnteros[i];
viEnteros[i]=viEnteros[i+1];
viEnteros[i+1]=aux;
band=0;
}

}

}
}
31 changes: 20 additions & 11 deletions ejercicio2/main.c
Original file line number Diff line number Diff line change
@@ -1,14 +1,23 @@
#include<stdio.h>
#include<stdlib.h>

int main(int argc, char* argv[])
{

//ESCRIBA AQUI ARRIBA EL CÓDIGO DE ENTRADA SALIDA PARA OBTENER LOS DATOS SOLICITADOS EN EL ENUNCIADO

printf("\n#SALIDA#\n");

//A PARTIR DE ESTE PUNTO LA SALIDA DEL PROGRAMA DEBE COINCIDIR EXACTAMENTE CON EL LOTE DE PRUEBA

return 0;
}
int main(int argc, char* argv[])
{
char *puntero;
char *a;
char palabra[100];
gets(palabra);
puntero = palabra;
printf("\n#SALIDA#\n");
printf("%s\n", puntero);
for (puntero = palabra; *puntero != '\0'; puntero++)
{
if(*puntero == ',')
{
a = puntero;
a = puntero+2;
printf("%s\n", a);
}
}
return 0;
}
26 changes: 21 additions & 5 deletions ejercicio3/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,36 @@ struct jugador {

int main(int argc, char* argv[])
{
struct jugador jugadores[MAX_PLAYERS];
int i;
struct jugador jugadores[MAX_PLAYERS], *indice[MAX_PLAYERS], *aux;
int i,ordenado = 1;

for(i=0; i < MAX_PLAYERS; i++) {
printf("Ingrese el nombre del jugador con id %d: ",i);
scanf("%s", jugadores[i].nombre);
printf("Ingrese el puntaje del jugador con id %d: ",i);
scanf("%d", &jugadores[i].puntaje);

jugadores[i].id=i;
jugadores[i].id=i;
indice[i]=&jugadores[i];}

while(ordenado){
ordenado=0;
for(i=0; i<MAX_PLAYERS-1; i++){
if(indice[i]->puntaje < indice[i+1]->puntaje){
aux=indice[i];
indice[i]=indice[i+1];
indice[i+1]=aux;
ordenado=1;
}
}

}
printf("\n#SALIDA#\n");
printf("ID, NOMBRE, PUNTAJE\n") ;
for(i=0; i<MAX_PLAYERS; i++){
printf("%d,%s,%d\n",indice[i]->id,indice[i]->nombre,indice[i]->puntaje);
}

printf("\n#SALIDA#\n");
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No debe quitar este printf, caso contrario el test automatizado no sabe a partir de donde comienza la salida del programa.


//A PARTIR DE ESTE PUNTO LA SALIDA DEL PROGRAMA DEBE COINCIDIR EXACTAMENTE CON EL LOTE DE PRUEBA
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

La salida debe coincidir EXACTAMENTE con el lote de pruebas. Faltan los títulos, y no coincide el orden de los campos

Salida esperada:

ID, Nombre, Puntaje
3, Juan, 150
1, Nevermore, 100
0, Berserker, 97
2, r4t0, 71
Salida obtenida:
Berserker,0,97
Berserker,0,97
r4t0,2,71
r4t0,2,71
r4t0,2,71


return 0;
Expand Down