Essays.club - Ensayos gratis, notas de cursos, notas de libros, tareas, monografías y trabajos de investigación
Buscar

EXAMEN PARCIAL 2 – ALGORITMICA II

Enviado por   •  9 de Enero de 2019  •  1.170 Palabras (5 Páginas)  •  382 Visitas

Página 1 de 5

...

Console.WriteLine(nombres[i]+" su deuda a la fecha es: S/."+nDeuda);

}

}

Console.ReadKey();

[pic 1]

EJERCICIO 2

//METODO PARA ORDENAR ALFABETICAMENTE

static void OrdenarXapellidos(ref string[] A,ref string [] N,ref DateTime[]F,ref string [] C,ref string [] CEL,ref string[] O,ref string [] DS,ref string [] DR, ref char [] G)

{

//PASOS

for (int i = 0; i

{

//COMPARACIONES

for (int j = i + 1; j

{

if (string.Compare(A[i], A[j]) == 1)

{

//INTERCAMBIO DE VALORES DE LOS APELLIDOS

string aux;

aux = A[i];

A[i] = A[j];

A[j] = aux;

//INTERCAMBIO DE VALORES DE LOS NOMBRES

string aux1;

aux1 = N[i];

N[i] = N[j];

N[j] = aux1;

//INTERCAMBIO DE FECHA DE NACIMIENTO

DateTime aux2=new DateTime();

aux2 = F[i];

F[i] = F[j];

F[j] = aux2;

//INTERCAMBIO DE CORREO

string aux3;

aux3 = C[i];

C[i] = C[j];

C[j] = aux3;

//INTERCAMBIO DE CELULAR

string aux4;

aux4 = CEL[i];

CEL[i] = CEL[j];

CEL[j] = aux4;

//INTERCAMBIO DE OPERADOR

string aux5;

aux5 = O[i];

O[i] = O[j];

O[j] = aux5;

//INTERCAMBIO DE DISTRITO

string aux6;

aux6 = DS[i];

DS[i] = DS[j];

DS[j] = aux6;

//INTERCAMBIO DE DIRECCION

string aux7;

aux7 = DR[i];

DR[i] = DR[j];

DR[j] = aux7;

//INTERCAMBIO DE GENERO

char aux8;

aux8 = G[i];

G[i] = G[j];

G[j] = aux8;

}

}

}

Console.WriteLine();

Console.WriteLine("************************************************");

Console.WriteLine("ORDENADO ALFABETICAMENTE POR APELLIDOS");

Console.WriteLine("************************************************");

for (int i = 0; i

{

Console.WriteLine("Persona {0}",i+1);

Console.WriteLine("Nombre y apellido: "+N[i]+" "+A[i]);

Console.WriteLine("Correo: "+C[i]);

Console.WriteLine("Celular y operador: "+CEL[i]+" "+O[i]);

Console.WriteLine("Direccion: "+DS[i]+" "+DR[i]);

Console.WriteLine("Fecha de nacimiento y genero: "+F[i].Day+"/"+F[i].Month+"/"+F[i].Year+" "+G[i]);

Console.WriteLine("************************************************");

}

}

//METODO CALCULAR CUMPLEAÑOS

static void CalCumple(ref DateTime[] A, ref string[] B, ref string[] C, ref string[] D,ref char [] G)

{

DateTime fHoy = DateTime.Now;

DateTime fNac;

Console.WriteLine("HOY ES CUMPLEAÑOS DE :");

for (int i = 0; i

{

fNac = A[i];

if (fNac.Day==fHoy.Day && fNac.Month ==fHoy.Month)

{

TimeSpan dif= fHoy-fNac;

Console.WriteLine(B[i]+" tiene "+dif.Days/365+" años");

Console.WriteLine("Correo: "+C[i]);

if (G[i].ToString().ToUpper()=="M")

{

Console.WriteLine("Genero: Masculino" );

}

else{

Console.WriteLine("Genero:

...

Descargar como  txt (11.5 Kb)   pdf (67.8 Kb)   docx (22.9 Kb)  
Leer 4 páginas más »
Disponible sólo en Essays.club