estructuras. porfavor
Publicado por princess (1 intervención) el 01/02/2007 19:28:06
Bueno tengo este codigo, mi duda es como le hago para que antes de salir de la aplicacion m e muestre los datos en pantalla. agradeceria toda su ayuda.
#include "iostream.h"
struct cliente
{
char nombre[50];
char direccion[50];
int DNI;
};
struct boleto
{
char placa[50];
char chofer[50];
double costo;
char origen[50];
char destino[50];
cliente asiento[4];
};
void Empresa (boleto autobus[2])
{
int i;
for( i=0;i<2;i++)
{
for(int j=0;j<4;j++)
{
cout<<" AUTOBUS "<<" "<<i+1<<" "<<endl;
cout<<"*******DATOS PERSONALES*******"<<endl;
cout<<"NOMBRE:"<<autobus[i].asiento[j].nombre<<endl;
cout<<"DIRECCION:"<<autobus[i].asiento[j].direccion<<endl;
cout<<"DNI:"<<autobus[i].asiento[j].direccion<<endl;
cout<<"NUMERO DE BOLETO:"<<"0"<<"0"<<j+1<<endl;
cout<<"******DATOS DEL VEHICULO******"<<" "<<i+1<<" "<<endl;
cout<<"PLACA:"<<autobus[i].placa<<endl;
cout<<"CHOFER:"<<autobus[i].chofer<<endl;
cout<<"COSTO:"<<autobus[i].costo<<endl;
cout<<"ORIGEN:"<<autobus[i].origen<<endl;
cout<<"DESTINO:"<<autobus[i].destino<<endl;
}
}
}
void main()
{
boleto autobus[2];
for(int i=0;i<2;i++)
{
cout<<"INGRESE DATOS DE LAS PERSONAS DEL AUTOBUS"<<" "<<i+1<<" "<<endl;
for(int j=0;j<4;j++)
{
cout<<"Ingrese nombre:"<<endl;
cin>> autobus[i].asiento[j].nombre;
cout<<"Ingrese direccion:"<<endl;
cin>> autobus[i].asiento[j].direccion;
cout<<"Ingrese DNI:"<<endl;
cin>> autobus[i].asiento[j].DNI;
cout<<"Numero de boleto:"<<endl;
cout<<"0"<<"0"<<j+1<<endl;
}
}
for( i=0;i<2;i++)
{
cout<<"INGRESE DATOS DEL VEHICULO"<<" "<<i+1<<" "<<endl;
cout<<"Ingrese placa:"<<endl;
cin>> autobus[i].placa;
cout<<"Ingrese chofer:"<<endl;
cin>> autobus[i].chofer;
cout<<"Ingrese costo:"<<endl;
cin>> autobus[i].costo;
cout<<"Ingrese origen:"<<endl;
cin>> autobus[i].origen;
cout<<"Ingrese destino:"<<endl;
cin>> autobus[i].destino;
}
Empresa(autobus);
}
#include "iostream.h"
struct cliente
{
char nombre[50];
char direccion[50];
int DNI;
};
struct boleto
{
char placa[50];
char chofer[50];
double costo;
char origen[50];
char destino[50];
cliente asiento[4];
};
void Empresa (boleto autobus[2])
{
int i;
for( i=0;i<2;i++)
{
for(int j=0;j<4;j++)
{
cout<<" AUTOBUS "<<" "<<i+1<<" "<<endl;
cout<<"*******DATOS PERSONALES*******"<<endl;
cout<<"NOMBRE:"<<autobus[i].asiento[j].nombre<<endl;
cout<<"DIRECCION:"<<autobus[i].asiento[j].direccion<<endl;
cout<<"DNI:"<<autobus[i].asiento[j].direccion<<endl;
cout<<"NUMERO DE BOLETO:"<<"0"<<"0"<<j+1<<endl;
cout<<"******DATOS DEL VEHICULO******"<<" "<<i+1<<" "<<endl;
cout<<"PLACA:"<<autobus[i].placa<<endl;
cout<<"CHOFER:"<<autobus[i].chofer<<endl;
cout<<"COSTO:"<<autobus[i].costo<<endl;
cout<<"ORIGEN:"<<autobus[i].origen<<endl;
cout<<"DESTINO:"<<autobus[i].destino<<endl;
}
}
}
void main()
{
boleto autobus[2];
for(int i=0;i<2;i++)
{
cout<<"INGRESE DATOS DE LAS PERSONAS DEL AUTOBUS"<<" "<<i+1<<" "<<endl;
for(int j=0;j<4;j++)
{
cout<<"Ingrese nombre:"<<endl;
cin>> autobus[i].asiento[j].nombre;
cout<<"Ingrese direccion:"<<endl;
cin>> autobus[i].asiento[j].direccion;
cout<<"Ingrese DNI:"<<endl;
cin>> autobus[i].asiento[j].DNI;
cout<<"Numero de boleto:"<<endl;
cout<<"0"<<"0"<<j+1<<endl;
}
}
for( i=0;i<2;i++)
{
cout<<"INGRESE DATOS DEL VEHICULO"<<" "<<i+1<<" "<<endl;
cout<<"Ingrese placa:"<<endl;
cin>> autobus[i].placa;
cout<<"Ingrese chofer:"<<endl;
cin>> autobus[i].chofer;
cout<<"Ingrese costo:"<<endl;
cin>> autobus[i].costo;
cout<<"Ingrese origen:"<<endl;
cin>> autobus[i].origen;
cout<<"Ingrese destino:"<<endl;
cin>> autobus[i].destino;
}
Empresa(autobus);
}
Valora esta pregunta


0