RESUMEN
RESUMEN
CLASE:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApp90
{
public struct LIBROS
{
public string nombreli,autor;
public int cinvent;
public double precio;
public int CANT;
public LIBROS( string a,string b,int c,double d,int E)
{
nombreli = a;autor = b;
cinvent = c;
precio = d;
CANT = E;
{
Console.WriteLine(" {0} {1} {2} {3} ", nombreli, autor, cinvent,
precio, CANT);
}
}
class LIBRO
{
LIBROS[] LI;
int I;
public LIBRO()
{
Console.WriteLine("CUANTOS LIBRO DESEA CONSULTAR");
int CANTLI = int.Parse(Console.ReadLine());
LI = new LIBROS[CANTLI];
for(I=0;I<LI.Length;I=I+1)
{
Console.WriteLine("NOMBRE");
string NOM = Console.ReadLine();
Console.WriteLine("AUTOR");
string AUT = Console.ReadLine();
Console.WriteLine("CANTIDAD DE INVENTARIO");
int CANTIN = int.Parse(Console.ReadLine());
Console.WriteLine("PRECIO");
double PREC = double.Parse(Console.ReadLine());
}
}
for(I=0;I<LI.Length;I=I+1)
{
MONTOTOT = MONTOTOT + LI[I].precio * LI[I].CANT;
}
return MONTOTOT;
}
return CAT;
}
for(int I=0;I<LI.Length;I=I+1)
{
if(LI[I].precio>MAYORPRE)
{
MAYORPRE = LI[I].precio;
}
}
for (int I = 0; I < LI.Length; I = I + 1)
{
if (LI[I].precio == MAYORPRE)
{
MAYORPRE = LI[I].precio;
Console.WriteLine("EL LIBRO CON MAYOR PRECIO ES {0}",
LI[I].nombreli);
}
}
}
for(I=0;I<LI.Length-1;I=I+1)
{
for(int J=I+1;J<LI.Length;J=J+1)
{
if(LI[I].precio>LI[J].precio)
{
AUX = LI[I];
LI[I] = LI[J];
LI[J] = AUX;
}
}
}
for(I=0;I<LI.Length;I=I+1)
{
LI[I].REPORTE();
}
}
}
}
MAIN
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApp90
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("BIENVENIDO AL SISTEMA DE LIBRERIA");
LIBRO L = new LIBRO();
Console.WriteLine("MONTO TOTAL {0} ", L.CALMONTOTOT());
Console.WriteLine("CANTIDAD DE INVENTARIO {0} ",L.CANTIDADINVENT());
L.CALMAYORPRE();
L.ORDENAR_SEGUN_PRECIO();
Console.ReadKey();
}
}
}