compilación con dos
TRANSCRIPT
![Page 1: Compilación con DOS](https://reader035.vdocumento.com/reader035/viewer/2022071723/55c376c1bb61eb011a8b46ae/html5/thumbnails/1.jpg)
PONTIFICIA UNIVERSIDAD CATÓLICA DEL ECUADOR SEDE IBARRA ESCUELA DE INGENIERIA CARRERA DE SISTEMAS
NOMBRE: Grace Laguna FECHA: 09-04-2013
NIVEL: Quinto
COMPILACIÓN CON DOS
1. Con la ayuda del cmd compilamos el programa.
2. Al ser compilado correctamente se crea un archivo .class
![Page 2: Compilación con DOS](https://reader035.vdocumento.com/reader035/viewer/2022071723/55c376c1bb61eb011a8b46ae/html5/thumbnails/2.jpg)
3. Aquí tenemos la pantalla del programa ejecutándose correctamente
Código del programa:
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package arreglos2;
import java.io.BufferedReader;
import java.io.InputStreamReader;
/**
*
* @author GRACE
*/
public class Arreglos2 {
/**
* @param args the command line arguments
![Page 3: Compilación con DOS](https://reader035.vdocumento.com/reader035/viewer/2022071723/55c376c1bb61eb011a8b46ae/html5/thumbnails/3.jpg)
*/
public static void main(String[] args) throws Exception{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
System.out.print("Ingrese n: ");
int n = Integer.parseInt(br.readLine());
int vector[] = new int[n];
for (int i = 0; i < n; i++)
{
System.out.print("Ingrese el valor en la posicion "+i+": ");
vector[i] = Integer.parseInt(br.readLine());
}
int aux;
if(n%2==0)
{
for (int i = 0; i < (n/2); i++)
{
for (int j = i; j < (n/2); j++)
{
if(vector[i]>vector[j]){
aux = vector[i];
vector[i]=vector[j];
vector[j]=aux;
}
}
}
for (int i = (n/2); i < n; i++)
{
for (int j = i; j < n; j++)
{
if(vector[i]<vector[j])
{
aux = vector[i];
vector[i]=vector[j];
vector[j]=aux;
}
}
}
}
else
{
![Page 4: Compilación con DOS](https://reader035.vdocumento.com/reader035/viewer/2022071723/55c376c1bb61eb011a8b46ae/html5/thumbnails/4.jpg)
for (int i = 0; i < n; i++)
{
for (int j = i; j < n; j++)
{
if(vector[i]>vector[j])
{
aux = vector[i];
vector[i]=vector[j];
vector[j]=aux;
}
}
}
}
for (int i = 0; i < n; i++)
{
System.out.print(vector[i]+",");
}
}
}