Advertisement
Guest User

Untitled

a guest
Jun 19th, 2019
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.42 KB | None | 0 0
  1. class Articulo{
  2.  
  3. public:
  4. string referencia;
  5. string nombre;
  6. int existente;
  7. int compra;
  8. int venta;
  9.  
  10. void capturar();
  11. void mostrar();
  12. void buscar();
  13.  
  14. };
  15.  
  16. void Articulo::capturar(){
  17. cout<<"t***INGRESAR ARTICULO NUEVO***n"<<endl;
  18. cout<<"NOMBRE DEL ARTICULO: ";cin>>nombre;
  19. cout<<"CANTIDAD EXISTENTE: ";cin>>existente;
  20. cout<<"PRECIO DE COMPRA: ";cin>>compra;
  21. cout<<"PRECIO DE VENTA: ";cin>>venta;
  22. cout<<endl;
  23. cout<<"tREGISTRO COMPLETADO CORRECTAMENTEn"<<endl;
  24. system("PAUSE");
  25. };
  26.  
  27. void Articulo::mostrar(){
  28. system("CLS");
  29. cout<<"***DATOS CAPTURADOS***"<<endl<<endl;
  30. cout<<"NOMBRE DEL ARTICULO: "<<nombre;
  31. cout<<endl;
  32. cout<<"CANTIDAD EXISTENTE: "<<existente;
  33. cout<<endl;
  34. cout<<"PRECIO DE COMPRA: "<<compra;
  35. cout<<endl;
  36. cout<<"PRECIO DE VENTA: "<<venta;
  37. cout<<endl;
  38. };
  39.  
  40. void Articulo::buscar(){
  41. string nombre2;
  42. cout<<"Escriba el nombre del articulo que desea buscar: ";
  43. cin>>nombre2;
  44. if(nombre2==nombre)
  45. {
  46. cout<<"ARTICULO ENCONTRADO"<<endl<<endl;
  47. Articulo datos2;
  48. datos2.mostrar();
  49. }
  50. else
  51. {
  52. cout<<"EL ARTICULO NO EXISTE"<<endl;
  53. }
  54. }
  55.  
  56. int main(){
  57.  
  58. Articulo datos;
  59. Articulo datos1;
  60. Articulo datos2;
  61. int opcion;
  62. opcion=0;
  63. do{
  64. cout<<"n t***MEN351 PRINCIPAL***n"<<endl<<endl;
  65. cout<<" 1.CAPTURAR n";
  66. cout<<" 2.MOSTRAR n";
  67. cout<<" 3.BUSCAR n";
  68. cout<<" 4.Salir n";
  69. cout<<"Eliga una opci242n: ";
  70. cin>>opcion;
  71. switch(opcion){
  72.  
  73. case 1:
  74. system("CLS");
  75. datos.capturar();
  76. system("PAUSE");
  77. system("CLS");
  78. break;
  79.  
  80. case 2:
  81. system("CLS");
  82. datos1.mostrar();
  83. system("PAUSE");
  84. system("CLS");
  85. break;
  86.  
  87. case 3:
  88. system("CLS");
  89. datos2.buscar();
  90. system("PAUSE");
  91. system("CLS");
  92. break;
  93.  
  94. case 4:
  95. cout<<"tFIN DEL PROGRAMAn";
  96. opcion = 4;
  97. break;
  98. default:
  99. cout<<"tE R R O Rn";
  100. system("PAUSE");
  101. system("CLS");
  102. break;
  103. }
  104. }while(opcion != 4);
  105.  
  106.  
  107. return 0;
  108. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement