Skip to content

Commit

Permalink
Merge pull request #10 from soypato/desarrollonacho
Browse files Browse the repository at this point in the history
version inestable de comidas
  • Loading branch information
iMonety authored Jun 21, 2023
2 parents 970716e + 0458108 commit 7417ee2
Show file tree
Hide file tree
Showing 18 changed files with 333 additions and 2 deletions.
Binary file modified BotellasFrigo.dat
Binary file not shown.
Binary file added MenuComidas.dat
Binary file not shown.
Binary file modified bin/Debug/tmphotel.exe
Binary file not shown.
35 changes: 35 additions & 0 deletions botellas.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ int menuBotellas()
printf("| 4 | Ordenar botellas por ID |\n"); // SELECCION
printf("| 5 | Buscar Marca |\n");
printf("| 6 | Modificar Segun usuario |\n");
printf("| 7 | Reciclar botellas retornables |\n");
printf("| 0 | Salir |\n");
printf("==========================================\n");
printf("Su decision: ");
Expand Down Expand Up @@ -66,6 +67,13 @@ int menuBotellas()
ModificarSegunUsuario(Arch, idTemporal);
break;

case 7:
ReciclarBotellas(Arch);

break;



case 0:
printf("Opción inválida. Por favor, ingrese nuevamente.\n");
break;
Expand Down Expand Up @@ -395,4 +403,31 @@ void ModificarSegunUsuario(char nombre[], int id)
}
}

void ReciclarBotellas(char nombre[]) {
FILE* Archi;
Archi = fopen(nombre, "r+b");
int idRetorn;
botellita Temp;
Pila Recicable;
inicpila(&Recicable);

if (Archi != NULL) {
while (fread(&Temp, sizeof(botellita), 1, Archi) > 0) {
printf("Ingrese el id de la botella que desea retornar (0 para salir):\n");
scanf("%d", &idRetorn);

if (idRetorn == 0) {
break; // Salir del bucle si se ingresa 0
}

if (Temp.id == idRetorn && Temp.retornable == 0) {
apilar(&Recicable, Temp.id);
}
}

mostrar(&Recicable);
fclose(Archi);
}
}


1 change: 1 addition & 0 deletions botellas.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ void ordenarBotellasPorID(char nombre[]);
void buscarBotellasPorMarca(char nombre[], const char* marcaBuscada);
int verificarIDExistente(char nombre[], int id);
void ModificarSegunUsuario(char[], int);
void ReciclarBotellas(char[]);



Expand Down
147 changes: 147 additions & 0 deletions comidas.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
#include <stdio.h>
#include <stdlib.h>
#include "comidas.h"

const char ArchC[]="MenuComidas.dat";


int menuComidas()
{
int op=0;
char decision;

do
{
printf("==========================================\n");
printf("| Menu comidas |\n");
printf("==========================================\n");
printf("| Opcion | Descripcion |\n");
printf("===========================================\n");
printf("| 1 | Agregar comidas |\n");
printf("| 2 | Mostrar comidas |\n");
printf("| 3 | Elegir comidas |\n");
printf("| 4 | Cambiar menu |\n");
printf("| 5 | Buscar comida |\n");
printf("| 0 | Salir |\n");
printf("==========================================\n");
printf("Su decision: ");
scanf("%i", &op);

switch (op)
{
case 1:
CargarAlimentosArchivo(ArchC, MATRIZ_F );
break;
case 2:

break;
case 3:

break;
case 4:

break;

case 0:
printf("Opción inválida. Por favor, ingrese nuevamente.\n");
break;

}

printf("Seguir ejecutando? (s/n): ");
fflush(stdin);
scanf(" %c", &decision);
}
while (decision == 's');


return 0;
}


int CargarAlimentos(Alimento Alimentos[][MATRIZ_S], int dimF)
{
int f=0;
char op='s';

while (f < dimF && op == 's')
{
printf("Ingrese la comida: ");
fflush(stdin);
gets(Alimentos.comida[]);

printf("Ingrese el postre: ");
fflush(stdin);
gets(Alimentos.postre[f]);

printf("Ingrese la fruta: ");
fflush(stdin);
gets(Alimentos.fruta[f]);

printf("Deseas seguir cargando alimentos (s/n)? ");
fflush(stdin);
scanf(" %c", &op);

f++;
}

return f;
}

void mostrarAlimentos(Alimento Alimentos, int validos)
{
int f=0;

for(f=0;f<validos;f++)
{
puts("|-------------------------------|");
printf("Comida: %s\n", Alimentos.comida[f]);
printf("Postre: %s\n", Alimentos.postre[f]);
printf("Fruta: %s\n", Alimentos.fruta[f]);
puts("|-------------------------------|");
}
}

void CargarAlimentosArchivo(char nombre[], int dimF)
{
FILE* Archi;

Archi = fopen(nombre, "ab");
Alimento Temp;
int validos = 0;

if(Archi!=NULL)
{
/*
validos = CargarAlimentos(Temp, dimF);
fwrite(&Temp, sizeof(Alimento), 1, Archi);
fclose(Archi);
printf("Se cargo correctamente\n");
*/
}
}

void mostrarAlimentosArchivo(char nombre[])
{
FILE* Archi;

Archi = fopen(nombre, "rb");
Alimento Temp;
if(Archi!=NULL)
{
fread(&Temp, sizeof(Alimento), 1, Archi);
{

}

fclose(Archi);
}





}



29 changes: 29 additions & 0 deletions comidas.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#ifndef COMIDAS_H_INCLUDED
#define COMIDAS_H_INCLUDED

#define MATRIZ_S 30
#define MATRIZ_F 3



typedef struct ///Arreglo de palabras/strings
{
char comida[MATRIZ_F][MATRIZ_S];
char postre[MATRIZ_F][MATRIZ_S];
char fruta[MATRIZ_F][MATRIZ_S];

} Alimento;




int CargarAlimentos(Alimento[][MATRIZ_S], int);
void mostrarAlimentos(Alimento, int);
void CargarAlimentosArchivo(char[], int );
void mostrarAlimentosArchivo(char[]);





#endif // COMIDAS_H_INCLUDED
6 changes: 5 additions & 1 deletion main.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,16 @@
#include <unistd.h> // Libreria para usleep (retraso en microsegundos)
#include "linkdepago.h"
#include "botellas.h"
<<<<<<< HEAD
#include "comidas.h"
=======
#include "empleados.h"
<<<<<<< HEAD
#include "porLimpiar.h"
=======
#include "preguntarDNI.h"
>>>>>>> 58d32f6160dc9bdee81f4bf67edee4af5402a548
>>>>>>> 970716e684cb5c50e4ac4eefaf7f02c2d71f30ec

void inicioSesion();
void limpiarPantalla();
Expand Down Expand Up @@ -73,7 +77,7 @@ void inicioSesion() {
break;
case claveRecepcionista:
printf(colorAmarillo "=== MENU RECEPCIONISTA ===\n" reiniciarColor);
menuBotellas();
menuComidas();
break;
case claveLimpieza:
printf(colorAmarillo "=== MENU LIMPIEZA ===\n" reiniciarColor);
Expand Down
Binary file modified obj/Debug/botellas.o
Binary file not shown.
Binary file added obj/Debug/comidas.o
Binary file not shown.
Binary file modified obj/Debug/linkdepago.o
Binary file not shown.
Binary file modified obj/Debug/main.o
Binary file not shown.
Binary file modified obj/Debug/pila.o
Binary file not shown.
Binary file modified obj/Debug/reservas.o
Binary file not shown.
Binary file modified obj/Debug/tiempo.o
Binary file not shown.
4 changes: 4 additions & 0 deletions tmphotel.cbp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@
<Option compilerVar="CC" />
</Unit>
<Unit filename="botellas.h" />
<Unit filename="comidas.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="comidas.h" />
<Unit filename="const.h" />

<Unit filename="empleados.c">
Expand Down
58 changes: 58 additions & 0 deletions tmphotel.depend
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,9 @@
1679999162 source:c:\storage\docs\learning-aprendizaje\aa tecnología\docs\utn\tup\cursada\primer cuatrimestre\prog-laboratorio\trabajo final\reservas-segunda-ver\pila.c
"pila.h"

<<<<<<< HEAD
1687231550 source:c:\users\usuario\desktop\utn tarea\prog 1 y lab 1\tp_final aportacionnacho\repodepatotb\reserva-hotel\linkdepago.c
=======
1687244091 source:c:\users\juanm\gestion-hotel\botellas.c
<stdio.h>
<stdlib.h>
Expand All @@ -302,12 +305,18 @@
<malloc.h>

1687244091 source:c:\users\juanm\gestion-hotel\linkdepago.c
>>>>>>> 970716e684cb5c50e4ac4eefaf7f02c2d71f30ec
<stdio.h>
<stdlib.h>
<string.h>
<time.h>
"const.h"

<<<<<<< HEAD
1687231550 c:\users\usuario\desktop\utn tarea\prog 1 y lab 1\tp_final aportacionnacho\repodepatotb\reserva-hotel\const.h

1687301535 source:c:\users\usuario\desktop\utn tarea\prog 1 y lab 1\tp_final aportacionnacho\repodepatotb\reserva-hotel\main.c
=======
1687244091 c:\users\juanm\gestion-hotel\const.h

1687244091 source:c:\users\juanm\gestion-hotel\pila.c
Expand Down Expand Up @@ -349,6 +358,7 @@
1687292550 c:\users\juanm\gestion-hotel\empleados.h

1687245650 source:c:\users\juanm\gestion-hotel\main.c
>>>>>>> 970716e684cb5c50e4ac4eefaf7f02c2d71f30ec
<stdio.h>
<stdlib.h>
"tiempo.h"
Expand All @@ -358,6 +368,44 @@
<unistd.h>
"linkdepago.h"
"botellas.h"
<<<<<<< HEAD
"comidas.h"

1687231550 c:\users\usuario\desktop\utn tarea\prog 1 y lab 1\tp_final aportacionnacho\repodepatotb\reserva-hotel\tiempo.h
<stdio.h>
<stdlib.h>

1687231550 c:\users\usuario\desktop\utn tarea\prog 1 y lab 1\tp_final aportacionnacho\repodepatotb\reserva-hotel\reservas.h

1687231550 c:\users\usuario\desktop\utn tarea\prog 1 y lab 1\tp_final aportacionnacho\repodepatotb\reserva-hotel\linkdepago.h

1687243475 c:\users\usuario\desktop\utn tarea\prog 1 y lab 1\tp_final aportacionnacho\repodepatotb\reserva-hotel\botellas.h
"pila.h"

1687232900 c:\users\usuario\desktop\utn tarea\prog 1 y lab 1\tp_final aportacionnacho\repodepatotb\reserva-hotel\pila.h
<stdio.h>
<malloc.h>

1687232900 source:c:\users\usuario\desktop\utn tarea\prog 1 y lab 1\tp_final aportacionnacho\repodepatotb\reserva-hotel\pila.c
"pila.h"

1687231550 source:c:\users\usuario\desktop\utn tarea\prog 1 y lab 1\tp_final aportacionnacho\repodepatotb\reserva-hotel\reservas.c
<stdio.h>
<stdlib.h>
<string.h>
"tiempo.h"
"reservas.h"
<stdio.h>
<string.h>

1687231550 source:c:\users\usuario\desktop\utn tarea\prog 1 y lab 1\tp_final aportacionnacho\repodepatotb\reserva-hotel\tiempo.c
<stdio.h>
<stdlib.h>
<string.h>
"tiempo.h"

1687244132 source:c:\users\usuario\desktop\utn tarea\prog 1 y lab 1\tp_final aportacionnacho\repodepatotb\reserva-hotel\botellas.c
=======
"empleados.h"
"preguntarDNI.h"

Expand All @@ -375,11 +423,20 @@
<stdio.h>

1687297936 source:d:\codeblock\codigos\reserva-hotel\botellas.c
>>>>>>> 970716e684cb5c50e4ac4eefaf7f02c2d71f30ec
<stdio.h>
<stdlib.h>
<string.h>
"botellas.h"

<<<<<<< HEAD
1687300783 source:c:\users\usuario\desktop\utn tarea\prog 1 y lab 1\tp_final aportacionnacho\repodepatotb\reserva-hotel\comidas.c
<stdio.h>
<stdlib.h>
"comidas.h"

1687302510 c:\users\usuario\desktop\utn tarea\prog 1 y lab 1\tp_final aportacionnacho\repodepatotb\reserva-hotel\comidas.h
=======
1687297936 d:\codeblock\codigos\reserva-hotel\botellas.h
"pila.h"

Expand Down Expand Up @@ -454,4 +511,5 @@
<string.h>
"tiempo.h"
>>>>>>> 58d32f6160dc9bdee81f4bf67edee4af5402a548
>>>>>>> 970716e684cb5c50e4ac4eefaf7f02c2d71f30ec

Loading

0 comments on commit 7417ee2

Please sign in to comment.