Advertisement
Guest User

LIBRERIA

a guest
Jun 16th, 2019
158
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 17.92 KB | None | 0 0
  1. #include<iostream>
  2. #include<cstdlib>
  3. #include<string.h>
  4. #include<stdio.h>
  5. #include<conio.h>
  6. #include<fstream>
  7. using namespace std;
  8. struct nodo{
  9.     int no;
  10.     int isbn;
  11.     char autor[50];
  12.     char titulo[50];
  13.     float venta;
  14.     float compra;
  15.     int exis;
  16.     char editorial[30];
  17.     struct nodo *sgte;
  18. };
  19. typedef struct nodo *PLista;
  20. struct nodo2{
  21.     int clave;
  22.     char nom[50];
  23.     char tel[12];
  24.     char correo[40];
  25.     struct nodo2 *sgt;
  26. };
  27. typedef struct nodo2 *PLista2;
  28. PLista lista=NULL;
  29. PLista2 lista2=NULL;
  30. int cont=1;
  31. int menu();//no recibe nada y retorna el valor de la opcion que elegiste
  32. int getRealKey(int);//recibe lo que retorne getch y lo retorna en un valor que puedas usar
  33. int menu(){
  34.     int op;
  35.     do{
  36.         cout<<"\n\t\t\t\t\t[ LIBRERIA ESPECIALIZADA EN DEPORTES ]\n";
  37.         cout<<"Elige tu opcion\n1. Libros\n2. Editoriales \n3. Reportes \n4. Ayuda \n5. Acerca de ...\n6. Salir\n"<<endl;
  38.         op=getche();//lee una entrada por teclado y te retorna el valor en codigo ascci
  39.         op=getRealKey(op);//obtiene el valor real pulsado para usarse -1 si es invalido
  40.         if(op==-1){
  41.             cout<<"\t INGRESE UNA OPCION VALIDA\n";
  42.         }
  43.         cout<<"\n";
  44.     }while(op==-1/*opcion invalida*/);
  45.     return op;
  46. }
  47. int getRealKey(int key){
  48.     int aux;
  49.     switch(key){
  50.         case 49://1 en ascii
  51.         case 12:// valor del ctrl+i
  52.             return 1;
  53.         case 50://2 en ascii
  54.         case 5://valor del ctrl+e
  55.             return 2;
  56.         case 51://3 en ascii
  57.         case 18://valor del ctrl+r
  58.             return 3;
  59.         case 52://4 en ascii
  60.             return 4;
  61.         case 0:
  62.             aux=getch();
  63.             if(aux==59){
  64.                 return 4; //f1 en ascii
  65.             }
  66.             else if(aux==60){ //f2 en ascii
  67.                 return 5;
  68.             }
  69.             else{
  70.                 return -1;//no se encuentra la combinacion valida
  71.             }
  72.         case 53:
  73.             return 5; //5 en ascii
  74.         case 54:
  75.         case 4:
  76.             return 6;
  77.         default:
  78.             return -1;
  79.     }
  80. }
  81. void menulib(){
  82.     cout<<"1. Agregar Libros"<<endl;
  83.     cout<<"2. Eliminar Libros"<<endl;
  84.     cout<<"3. Modificar datos de Libros"<<endl;
  85.     cout<<"4. Buscar Libros"<<endl;
  86.     cout<<"5. Regresar al Menu Principal"<<endl;
  87. }
  88. void menuedi(){
  89.     cout<<"1. Agregar Editorial"<<endl;
  90.     cout<<"2. Eliminar Editorial"<<endl;
  91.     cout<<"3. Modificar datos de Editorial"<<endl;
  92.     cout<<"4. Buscar Editorial por clave"<<endl;
  93.     cout<<"5. Regresar al Menu Principal"<<endl;
  94. }
  95. void menurep(){
  96.     cout<<"1. Reporte de libros"<<endl;
  97.     cout<<"2. Reporte de editoriales"<<endl;
  98.     cout<<"3. Reporte de inventarios"<<endl;
  99.     cout<<"4. Regresar al Menu Principal"<<endl;
  100. }
  101. void insertarlib(PLista &lista){
  102.     PLista q = new(struct nodo);
  103.     int is;
  104.     cout<<" \nREGISTRO DE NUEVOS LIBROS"<<endl;
  105.     cout<<"Numero de libro:"<<cont<<endl;
  106.     q->no=cont;
  107.     cout<<"Ingresa el ISBN:";
  108.     cin>>is;
  109.     q->isbn=is;
  110.     cin.ignore();
  111.     cout<<"Ingresa el autor:";
  112.     cin.getline(q->autor, 50);
  113.     cout<<"Ingresa titulo del libro:";
  114.     cin.getline(q->titulo, 50);
  115.     cout<<"Costo al publico:";
  116.     cin>>q->venta;
  117.     cout<<"Costo original:";
  118.     cin>>q->compra;
  119.     cout<<"Existencia del libro:";
  120.     cin>>q->exis;
  121.     cin.ignore();
  122.     cout<<"Editorial:";
  123.     cin.getline(q->editorial, 30);
  124.     nodo *aux1=lista;
  125.     nodo *aux2;
  126.     while ((aux1!=NULL) && (aux1->isbn<is)){
  127.         aux2=aux1;
  128.         aux1=aux1->sgte;
  129.     }
  130.     if (lista==aux1){
  131.         lista=q;
  132.     }
  133.     else{
  134.         aux2->sgte=q;
  135.     }
  136.     q->sgte=aux1;
  137.     cont++;
  138. }
  139. void eliminarlib(PLista &lista){
  140.     int cod;
  141.     PLista q,t;
  142.     q=lista;
  143.     cout<<"\nELIMINAR DATOS DE UN LIBRO"<<endl;
  144.     cout<<"Ingrese ISBN: ";
  145.     cin>>cod;
  146.     while(q!=NULL){
  147.         if(q->isbn==cod){
  148.             if(q==lista)
  149.                 lista=lista->sgte;
  150.             else
  151.                 t->sgte=q->sgte;
  152.             delete(q);
  153.             cout<<"REGISTRO ELIMINADO CON EXITO"<<endl;
  154.             return;
  155.             }else {
  156.                 t=q;
  157.                 q=q->sgte;
  158.             }
  159.     }
  160.     if(q==NULL)
  161.         cout<<"ISBN NO COINCIDE CON NINGUN LIBRO"<<endl;
  162. }
  163. void modlib(PLista lista){
  164.     int x, cod;
  165.     PLista q;
  166.     q=lista;
  167.     cout<<"ACTUALIZAR REGISTRO DE UN LIBRO"<<endl;
  168.     cout<<"\tIngrese el ISBN al que desea realizar modificaciones: ";
  169.     cin>>cod;
  170.     while(q!=NULL){
  171.         if(q->isbn==cod){
  172.             system("cls");
  173.             cout<<"Dato encontrado exitosamente"<<endl;
  174.             cout<<"Numero: "<<q->no<<endl;
  175.             cout<<"ISBN: "<<q->isbn<<endl;
  176.             cout<<"Autor: "<<q->autor<<endl;
  177.             cout<<"Titulo: "<<q->titulo<<endl;
  178.             cout<<"Venta: "<<q->venta<<endl;
  179.             cout<<"Compra: "<<q->compra<<endl;
  180.             cout<<"Existencia: "<<q->exis<<endl;
  181.             cout<<"Editorial: "<<q->editorial<<endl;
  182.             cout<<"\t[    SELECCIONE EL CAMPO QUE DESEA MODIFICAR    ]\n";
  183.             cout<<" 1. ISBN                    "<<endl;
  184.             cout<<" 2. Autor                     "<<endl;
  185.             cout<<" 3. Titulo                      "<<endl;
  186.             cout<<" 4. Venta                         "<<endl;
  187.             cout<<" 5. Compra                  "<<endl;
  188.             cout<<" 6. Existencia        "<<endl;
  189.             cout<<" 7. Editorial         "<<endl;
  190.             cout<<" 8. Cancelar"<<endl;
  191.             cout<<"Ingrese Opcion: ";
  192.             cin>>x;
  193.             switch(x){
  194.                 case 1: cout<<"Ingrese ISBN: ";
  195.                         cin>>q->isbn;
  196.                         cout<<"\tREGISTRO ACTUALIZADO EXITOSAMENTE"<<endl;
  197.                         break;
  198.                 case 2: cout<<"Ingrese Autor: ";
  199.                         cin.ignore();
  200.                         cin.getline(q->autor, 50);
  201.                         cout<<"\tREGISTRO ACTUALIZADO EXITOSAMENTE"<<endl;
  202.                         break;
  203.                 case 3: cin.ignore();
  204.                         cout<<"Ingrese Titulo: ";
  205.                         cin.getline(q->titulo, 50);
  206.                         cout<<"\tREGISTRO ACTUALIZADO EXITOSAMENTE"<<endl;
  207.                         break;
  208.                 case 4: cout<<"Ingrese el Costo al Publico:"<<endl;
  209.                         cin>>q->venta;
  210.                         break;
  211.                 case 5: cout<<"Ingrese el Costo Original: "<<endl;
  212.                         cin>>q->compra;
  213.                         break;
  214.                 case 6: cout<<"Ingrese la Existencia: "<<endl;
  215.                         cin>>q->exis;
  216.                         break;
  217.                 case 7: cout<<"Ingrese Editorial: "<<endl;
  218.                         cin.ignore();
  219.                         cin.getline(q->editorial,30);
  220.                         break;
  221.                 case 8: cout<<"Proceso de actualizacion cancelado"<<endl;
  222.                         break;
  223.                 default: cout<<"INGRESE UNA OPCION VALIDA"<<endl;
  224.                 cout<<"\n";
  225.                 system("pause");
  226.                 system("cls");
  227.                 }
  228.                 return;
  229.             }else {
  230.                 q=q->sgte;
  231.         }
  232.     }
  233.     if(q==NULL)
  234.         cout<<"ISBN INCORRECTO"<<endl;
  235. }
  236. void Buscar(PLista q){
  237.      int cod;
  238.     if(q!=NULL){
  239.         cout<<"\nINGRESE NUMERO A BUSCAR: ";
  240.         cin>>cod;
  241.           while(q!=NULL){
  242.             if(q->isbn==cod){
  243.                 system("cls");
  244.                 cout<<"Dato encontrado exitosamente"<<endl;
  245.                 cout<<"Numero: "<<q->no<<endl;
  246.                 cout<<"ISBN: "<<q->isbn<<endl;
  247.                 cout<<"Autor: "<<q->autor<<endl;
  248.                 cout<<"Titulo: "<<q->titulo<<endl;
  249.                 cout<<"Venta: "<<q->venta<<endl;
  250.                 cout<<"Compra: "<<q->compra<<endl;
  251.                 cout<<"Existencia: "<<q->exis<<endl;
  252.                 cout<<"Editorial: "<<q->editorial<<endl;
  253.                 cout<<"\n";
  254.                 return;
  255.             }else {
  256.                 q=q->sgte;
  257.         }
  258.     }
  259.     if(q==NULL)
  260.         cout<<"ISBN INCORRECTO"<<endl;
  261.     }
  262. }
  263. void insertaredit(PLista2 &lista2){
  264.     PLista2 q = new(struct nodo2);
  265.     int cla;
  266.     cout<<" \nREGISTRO DE NUEVAS EDITORIALES"<<endl;
  267.     cout<<"Ingresa la clave: ";
  268.     cin>>cla;
  269.     q->clave=cla;
  270.     cin.ignore();
  271.     cout<<"Ingresa el nombre: ";
  272.     cin.getline(q->nom, 50);
  273.     cout<<"Ingresa telefono de contacto: ";
  274.     cin>>q->tel;
  275.     cin.ignore();
  276.     cout<<"Ingresa un correo: ";
  277.     cin.getline(q->correo, 40);
  278.     cout<<"\n";
  279.     cout<<"EDITORIAL REGISTRADA"<<endl;
  280.     nodo2 *aux1=lista2;
  281.     nodo2 *aux2;
  282.     while ((aux1!=NULL) && (aux1->clave<cla)){
  283.         aux2=aux1;
  284.         aux1=aux1->sgt;
  285.     }
  286.     if(lista2==aux1){
  287.         lista2=q;
  288.     }
  289.     else{
  290.         aux2->sgt=q;
  291.     }
  292.     q->sgt=aux1;
  293. }
  294. void eliminaredit(PLista2 &lista2){
  295.     int cod;
  296.     PLista2 q,t;
  297.     q=lista2;
  298.     cout<<"\nELIMINAR DATOS DE UNA EDITORIAL"<<endl;
  299.     cout<<"Ingrese clave de editorial a eliminar: ";
  300.     cin>>cod;
  301.     while(q!=NULL){
  302.         if(q->clave==cod){
  303.             if(q==lista2)
  304.                 lista2=lista2->sgt;
  305.             else
  306.                 t->sgt=q->sgt;
  307.             delete(q);
  308.             cout<<"\tREGISTRO ELIMINADO CON EXITO"<<endl;
  309.             return;
  310.         }else {
  311.             t=q;
  312.             q=q->sgt;
  313.         }
  314.     }
  315.     if(q==NULL)
  316.         cout<<"NUMERO NO COINCIDE CON NINGUN LIBRO"<<endl;
  317. }
  318. void modedit(PLista2 lista2){
  319.     int cod, x;
  320.     PLista2 q;
  321.     q=lista2;
  322.     cout<<"ACTUALIZAR REGISTRO DE UNA EDITORIAL"<<endl;
  323.     cout<<"\tIngrese la clave para la que desea realizar modificaciones: ";
  324.     cin>>cod;
  325.     while(q!=NULL){
  326.         if(q->clave==cod){
  327.             system("cls");
  328.             cout<<"Dato encontrado exitosamente"<<endl;
  329.             cout<<"Clave: "<<q->clave<<endl;
  330.             cout<<"Nombre: "<<q->nom<<endl;
  331.             cout<<"Telefono: "<<q->tel<<endl;
  332.             cout<<"Correo: "<<q->correo<<endl;
  333.             cout<<"\t[    SELECCIONE EL CAMPO QUE DESEA MODIFICAR    ]\n";
  334.             cout<<" 1. Clave                       "<<endl;
  335.             cout<<" 2. Nombre                    "<<endl;
  336.             cout<<" 3. Telefono                     "<<endl;
  337.             cout<<" 4. Correo                      "<<endl;
  338.             cout<<" 5. Cancelar                    "<<endl;
  339.             cout<<"Ingrese Opcion: ";
  340.             cin>>x;
  341.             switch(x){
  342.                 case 1: cout<<"Ingrese Clave Nueva: ";
  343.                         cin>>q->clave;
  344.                         cout<<"\tREGISTRO ACTUALIZADO EXITOSAMENTE"<<endl;
  345.                         break;
  346.                 case 2: cout<<"Ingrese Nombre: ";
  347.                         cin>>q->nom;
  348.                         cout<<"\tREGISTRO ACTUALIZADO EXITOSAMENTE"<<endl;
  349.                         break;
  350.                 case 3: cout<<"Ingrese Telefono: ";
  351.                         cin>>q->tel;
  352.                         cout<<"\tREGISTRO ACTUALIZADO EXITOSAMENTE"<<endl;
  353.                         break;
  354.                 case 4: cin.ignore();
  355.                         cout<<"Ingrese Correo: ";
  356.                         cin.getline(q->correo, 50);
  357.                         cout<<"\tREGISTRO ACTUALIZADO EXITOSAMENTE"<<endl;
  358.                         break;
  359.                 case 5: cout<<"Proceso de actualizacion cancelado"<<endl;
  360.                         break;
  361.                 default: cout<<"INGRESE UNA OPCION VALIDA"<<endl;
  362.             }
  363.                 return;
  364.             }else {
  365.                 q=q->sgt;
  366.         }
  367.     }
  368.     if(q==NULL)
  369.         cout<<"CLAVE INCORRECTO"<<endl;
  370. }
  371.  
  372. void Buscaredit(PLista2 q){
  373.     int cod;
  374.     if(q!=NULL){
  375.         cout<<"\nINGRESE CLAVE A BUSCAR: ";
  376.         cin>>cod;
  377.         while(q!=NULL){
  378.             if(q->clave==cod){
  379.                 system("cls");
  380.                 cout<<"Clave: "<<q->clave<<endl;
  381.                 cout<<"Nombre: "<<q->nom<<endl;
  382.                 cout<<"Telefono: "<<q->tel<<endl;
  383.                 cout<<"Correo: "<<q->correo<<endl;
  384.                 cout<<"\n";
  385.                 return;
  386.             }else {
  387.                 q=q->sgt;
  388.         }
  389.     }
  390.     if(q==NULL)
  391.         cout<<"CLAVE INCORRECTA"<<endl;
  392.     }
  393. }
  394.  
  395. void replibro(PLista q){
  396.     while(q!=NULL){
  397.         cout<<q->no<<"\t"<<q->isbn<<"\t"<<q->autor<<"\t\t"<<q->titulo<<"\t"<<q->venta<<"\t"<<q->compra<<"\t\t"<<q->exis<<"\t\t"<<q->editorial<<"\n";
  398.         q=q->sgte;
  399.     }
  400.     cout<<"--------------------------------------------------------------------------------------------------"<<endl;
  401. }
  402.  
  403. void repedit(PLista2 q){
  404.     while(q!=NULL){
  405.         cout<<q->clave<<"\t"<<q->nom<<"\t"<<q->tel<<"\t"<<q->correo<<endl;
  406.         q=q->sgt;
  407.     }
  408. }
  409.  
  410. void invlibro(PLista q){
  411.     float inv=0,gan=0;
  412.     while(q!=NULL){
  413.         cout<<q->no<<"\t"<<q->isbn<<"\t"<<q->autor<<"\t\t"<<q->titulo<<"\t"<<q->venta<<"\t"<<q->compra<<"\t\t"<<q->exis<<"\t\t"<<q->editorial<<"\n";
  414.         inv=inv+((q->compra)*(q->exis));
  415.         gan=gan+((q->venta)*(q->exis));
  416.         q=q->sgte;
  417.     }
  418.     cout<<"--------------------------------------------------------------------------------------------------"<<endl;
  419.     cout<<"Total invertido: "<<inv<<"\t";
  420.     cout<<"Ganancia esperada: "<<gan<<endl;
  421.     cout<<"--------------------------------------------------------------------------------------------------"<<endl;
  422. }
  423.  
  424. void acerca(){
  425.     ifstream archivo;
  426.     string texto;
  427.     archivo.open("Acerca de.txt",ios::in);//Agregar el nombre del archivo
  428.     if(archivo.fail()){
  429.         cout<<"Archivo no encontrado";
  430.         exit(1);
  431.     }
  432.     while(!archivo.eof()){
  433.         getline(archivo,texto);
  434.         cout<<texto<<endl;
  435.     }
  436.     archivo.close();
  437. }
  438.  
  439. void ayuda(){
  440.     ifstream archivo;
  441.     string texto;
  442.     archivo.open("Ayuda.txt",ios::in);//Agregar el nombre del archivo
  443.     if(archivo.fail()){
  444.         cout<<"Archivo no encontrado";
  445.         exit(1);
  446.     }
  447.     while(!archivo.eof()){
  448.         getline(archivo,texto);
  449.         cout<<texto<<endl;
  450.     }
  451.     archivo.close();
  452. }
  453. ///--------------------------------F U N C I O N     P R I N C I P A L--------------------------------------------------------
  454.  
  455. int main(){
  456.     int op;
  457.     do{
  458.         op=menu();
  459.         switch(op){
  460.         case 1:
  461.             do{
  462.             system("cls");
  463.             menulib();
  464.             cin>>op;
  465.             cout<<endl;
  466.             switch(op){
  467.                 case 1: insertarlib(lista);
  468.                         system("pause");
  469.                         system("cls");
  470.                     break;
  471.                 case 2: if(lista == NULL){
  472.                             cout<<"\t No hay algun libro registrado\n";
  473.                         }else{
  474.                             eliminarlib(lista);
  475.                             system("pause");
  476.                             system("cls");
  477.                         }
  478.                     break;
  479.                 case 3: if(lista==NULL){
  480.                             cout<<"\nNo hay algun libro registrado\n";
  481.                         }else{
  482.                             modlib(lista);
  483.                         }
  484.                         system("pause");
  485.                         system("cls");
  486.                     break;
  487.                 case 4: if(lista==NULL){
  488.                             cout<<"\n\tNo hay algun libro registrado\n";
  489.                         }else{
  490.                             Buscar(lista);
  491.                         }
  492.                         system("pause");
  493.                         system("cls");
  494.                     break;
  495.                 }
  496.                
  497.             }while(op!=5);
  498.             system("cls");
  499.         break;
  500.         case 2:
  501.         do{
  502.             menuedi();
  503.             cin>>op;
  504.             cout<<endl;
  505.             switch(op){
  506.                 case 1: insertaredit(lista2);
  507.                         system("pause");
  508.                         system("cls");
  509.                 break;
  510.                 case 2: if(lista2 == NULL){
  511.                             cout<<"\t No hay editorial registrada\n";
  512.                         }else{
  513.                             eliminaredit(lista2);
  514.                         }
  515.                         system("pause");
  516.                         system("cls");
  517.                     break;
  518.                 case 3: if(lista2==NULL){
  519.                             cout<<"\n\tNo hay editorial registrada\n";
  520.                         }else{
  521.                             modedit(lista2);
  522.                         }
  523.                         system("pause");
  524.                         system("cls");
  525.                     break;
  526.                 case 4: if(lista2==NULL){
  527.                             cout<<"\n\tNo hay editorial registrada\n";
  528.                         }else{
  529.                             Buscaredit(lista2);
  530.                         }
  531.                          system("pause");
  532.                         system("cls");
  533.                     break;
  534.             }
  535.         }while(op!=5);
  536.         system("cls");
  537.         break;
  538.         case 3:
  539.             do{
  540.                 menurep();
  541.                 cin>>op;
  542.                 system("cls");
  543.                 switch(op){
  544.                     case 1:
  545.                     if(lista==NULL){
  546.                                 cout<<"No se encuentran registros para generar un reporte"<<endl;
  547.                         }else{
  548.                            
  549.                             cout<<"\t\t\t\tREPORTE DE LIBROS"<<endl;
  550.                             cout<<"--------------------------------------------------------------------------------------------------"<<endl;
  551.                             cout<<"\t\t\t\t\t\t    PRECIO"<<endl;
  552.                             cout<<"No.\t ISBN \t AUTOR \t\t TITULO \t VENTA \t COMPRA \t EXISTENCIA \t EDITORIAL\n ";
  553.                             cout<<"--------------------------------------------------------------------------------------------------"<<endl;
  554.                             replibro(lista);
  555.                             cout<<"--------------------------------------------------------------------------------------------------"<<endl;
  556.                             }
  557.                             system("pause");
  558.                             system("cls");
  559.                     break;
  560.                     case 2: if(lista2==NULL){
  561.                                 cout<<"No se encuentran registros para generar un reporte"<<endl;
  562.                             }else{
  563.                                 cout<<"\t\t\t\tREPORTE DE EDITORIALES"<<endl;
  564.                                 cout<<"--------------------------------------------------------------------------------------------------"<<endl;
  565.                                 cout<<"CLAVE\t NOMBRE \t TELEFONO \t CORREO\n ";
  566.                                 cout<<"--------------------------------------------------------------------------------------------------"<<endl;
  567.                                 repedit(lista2);
  568.                                 cout<<"--------------------------------------------------------------------------------------------------"<<endl;
  569.                                 }
  570.                             system("pause");
  571.                             system("cls");
  572.                     break;
  573.                     case 3: if(lista==NULL){
  574.                                 cout<<"No se encuentran registros para generar un reporte"<<endl;                      
  575.                             }else{
  576.                                 cout<<"\t\t\t\tREPORTE DE INVENTARIO DE LIBROS"<<endl;
  577.                                 cout<<"--------------------------------------------------------------------------------------------------"<<endl;
  578.                                 cout<<"\t\t\t\t\t\t    PRECIO"<<endl;
  579.                                 cout<<"No.\t ISBN \t AUTOR \t\t TITULO \t VENTA \t COMPRA \t EXISTENCIA \t EDITORIAL\n ";
  580.                                 cout<<"--------------------------------------------------------------------------------------------------"<<endl;
  581.                                 invlibro(lista);
  582.                             }
  583.                         }
  584.                         system("pause");
  585.                         system("cls");
  586.                     break;
  587.             }while(op!=4);
  588.         break;
  589.         case 4: ayuda();
  590.                 system("pause");
  591.                 system("cls");
  592.         break;
  593.         case 5:acerca();
  594.                 system("pause");
  595.                 system("cls");
  596.         break;
  597.         case 6: exit(0);
  598.         }
  599.     }while(op!=6);
  600.     getch();
  601.     return 0;
  602. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement