Dev - C++ - Tengo un problema con un programa

 
Vista:

Tengo un problema con un programa

Publicado por Jenifer (3 intervenciones) el 11/08/2009 21:55:32
tengo problema con este programa como hacer queen new proyect aparezcan los menu en un solo programa

/*creacion de lista
listado de habitaciones disponibles
listado de habitaciones reservadas
listado de habitaciones ocupadas*/

#include <iostream.h>
#include <fstream.h>

void estado_habit()
{
struct Habitaciones
{

int reservacion;
int reserv_habit;
int disponible;
int dispb_habit;
int ocupadas;
int ocupd_habit;
int total_habit;
char fecha[12];
int num_habit;

};
struct Habitaciones lista;

char continuar;
int opcion;

ofstream Estado_habit("estado.dat", ios::out | ios::binary);//Crea archivo para introducir datosque se piden
if (!Estado_habit)
{
cerr<<"ERROR"<<endl;
}

cout<<" **Bienvenidos(as) al Sistema de Control de Habitaciones"<<endl;
cout <<" *** HOTEL CALIFORNIA *** ";


do
{
cout<<" **Que operacion desea realizar** "<<endl;
cout<<"1.Total de habitaciones en el hotel"<<endl;
cout<<"2.Habitaciones disponibles"<<endl;
cout<<"3.Habitaciones ocupadas"<<endl;
cout<<"4.Habitaciones reservadas"<<endl;
cout<<"5.Salida "<<endl;
cin>>opcion;
cout<<endl<<endl;

Estado_habit.seekp(0, ios::beg);//busqueda en el archivo desde el inicio=beg

switch(opcion)
{
case 1:{
cout<<"Cuantas habitaciones tiene su hotel"<<endl; //pregunta por el total de habitaciones
cin>>lista.total_habit; //en el hotel
cout<<endl;

Estado_habit.write(reinterpret_cast<char *> (&lista), sizeof(lista));//escritura

};break;

case 2:{
cout<<"Cuantas habitaciones estan disponibles"<<endl;
cin>>lista.disponible;

cout<<"Cuales habitaciones estan disponibles y hasta que fecha"<<endl;
for(int j=1;j<=lista.disponible; j++) //estan disponibles
{
cin>>lista.num_habit;
cout<<endl;
cin>>lista.fecha;
cout<<endl;

Estado_habit.write(reinterpret_cast<char *> (&lista), sizeof(lista));

}
};break;

case 3:{

cout<<"Cuantas habitaciones estan ocupadas"<<endl; //pregunta cuantas habitaciones estan
cin>>lista.ocupadas; //ocupadas

cout<<"Cuales son la habitaciones ocupadas y por cuanto tiempo"<<endl;//pregunta cuales son las habitaciones
for(int j=1;j<=lista.ocupadas; j++) //estan ocupadas
{
cin>>lista.num_habit;
cout<<endl;
cin>>lista.fecha;
cout<<endl;

Estado_habit.write(reinterpret_cast<char *> (&lista), sizeof(lista));//Escritura en el archivo

}
};break;

case 4:{

cout<<"Cuantas habitaciones estan reservadas"<<endl; //pregunta cuantas habitaciones estan
cin>>lista.reservacion; //reservadas

cout<<"Cuales son la habitaciones reservadas y por cuanto tiempo"<<endl;//pregunta cuales son las habitaciones
for(int j=1;j<=lista.reservacion; j++) //estan reservadas
{
cin>>lista.num_habit;
cout<<endl;
cin>>lista.fecha;
cout<<endl;

Estado_habit.write(reinterpret_cast<char *> (&lista), sizeof(lista));

}
};break;

case 5: cout<<" ******** MUCHAS GRACIAS POR SU VISITA ********"<<endl;break;

default:cout<<"Error esa opcion no existe"<<endl;
}

cout<<"Desea seguir viendo el menu (s/n) ";//Pregunta si desea continuar usando el program
cin>>continuar;
cout<<endl<<endl<<endl;
}
while(continuar=='s');

}
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder

RE:Tengo un problema con un programa

Publicado por Diana (2 intervenciones) el 13/08/2009 06:12:38
EN C
HOLA NECESITO HACER UN PROGRAMA QUE CONSISTE QUE DADA UNA LISTA DE 10 PRODUCTOS DE UNA TIENDA DE ABARROTES CON PRECIO, PERMITA AL USUARIO SELECCIONAR DE ESA LISTA 5 PRODUCTOS Y A CONTINUACION OBTENGA EL TOTAL DE LA SUMA DE LOS PRECIOS DE LOS PRODUCTOS Y QUE LA MISMA PANTALLA MUESTRE LOS PRODUCTOS SELECCIONADOS Y EL TOTAL DE LA SUMA.

PRODUCTO PRECIO
1 REFRESCO 500ML 8
2 SABRITAS 6
3 CAJA DE CHICLES 10
4 FRASCO DE CAFE 30
5 AGUA 500ML 6
6 CIGARROS 25
7 MERMELADA 35
8 YOGURT 7
9 GALLETAS 6
10 PALETA 3
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar

RE:Tengo un problema con un programa

Publicado por Diana (2 intervenciones) el 13/08/2009 06:20:17
EN C
HOLA NECESITO HACER UN PROGRAMA QUE CONSISTE QUE DADA UNA LISTA DE 10 PRODUCTOS DE UNA TIENDA DE ABARROTES CON PRECIO, PERMITA AL USUARIO SELECCIONAR DE ESA LISTA 5 PRODUCTOS Y A CONTINUACION OBTENGA EL TOTAL DE LA SUMA DE LOS PRECIOS DE LOS PRODUCTOS Y QUE LA MISMA PANTALLA MUESTRE LOS PRODUCTOS SELECCIONADOS Y EL TOTAL DE LA SUMA.

PRODUCTO PRECIO
1 REFRESCO 500ML 8
2 SABRITAS 6
3 CAJA DE CHICLES 10
4 FRASCO DE CAFE 30
5 AGUA 500ML 6
6 CIGARROS 25
7 MERMELADA 35
8 YOGURT 7
9 GALLETAS 6
10 PALETA 3
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar

Tengo un problema con un programa

Publicado por alexis (1 intervención) el 08/11/2017 05:17:27
hola como estas fijate que yo estoy haciendo un proyecto similar y estoy viendo como hacer eso tu me puedes decir si pudiste componer tu programa ya que yo tengo el mismo probllema por favor te dejo mi correo es [email protected]
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar