kindly help me in this program it is not get the output from file contents pls pls

#include<iostream.h>
#include<conio.h>
#include<stdlib.h>
#include<string.h>
#include<fstream.h>
#include<graphics.h>
void input();
void output ();
struct dom
{
int date;
int month;
int year;
};
struct reg
{
int nos;
char a[3];
};
struct chasno
{
reg chs;
};
struct engno
{
reg engno;
};
struct ve
{
engno e1;
chasno e2;
reg e3;
dom domm;
char model[12];
char clo[10];
int hrspwr;
int sitcap;
};
struct truck
{
ve bsc;
int ldngcap;
int nowhel;
};
void main ()
{
char q;
do
{
clrscr();
ve car,bike;
truck truck1;
int a;
cout<<"==============******************* Welcome ******************====================\n";
cout<<"==============*************** Sunshine Autos ******************=================\n";
cout<<"Please follow the opitions\n";
cout<<" 1.for input data for Bike.\n ";
cout<<"2.for input data for Car.\n ";
cout<<"3.for input data for Truck.\n ";
cout<<"4.to see the inputed data for bike.\n";
cout<<" 5.to see the inputed data for car.\n";
cout<<" 6.to see the inputed data for truck.\n";
cout<<" 7.to exit from data base.\n";
cin>>a;
cout<<"Your Selection is "<<a<<"\n";
if(a==1)
{
cout<<"You have enterd Bike input\n\n";
input();
}
else if(a==2)
{
cout<<"You have enterd Car input\n\n";
input();
}
else if(a==3)
{
cout<<"You have enterd Truck input\n\n";
input();
}
else if(a==4)
{
cout<<"You have enterd to show input of bike\n\n";
output();
}
else if(a==5)
{
cout<<"You have enterd to show input of car\n\n";
output();
}
else if(a==6)
{
cout<<"You have enterd to show input of truck\n\n";
output();
}
else if(a==7)
{
cout<<"Good Bye\n";
exit(1);
}
else
{
cout<<"please enter correct input\n\n";
}

cout<<"Do you want to countinue ?(Press 'y' for 'yes' & 'n' for 'no').\n";
cin>>q;
} while(q=='y'||q=='Y');
getch();
}
void input ()
{
ofstream file;
file.open("sunshinelove.txt",ios::out);
ve obj;
cout<<"Please enter the following feilds\n";
cout<<"\nPlease enter the date of manufacture.\n";
cin>> obj.domm.date;
file<<obj.domm.date<<".";
cout<<"Please enter the month of manufacture.\n";
cin>> obj.domm.month;
file<< obj.domm.month<<".";
cout<<"Please enter the year of manufacture.\n";
cin>> obj.domm.year;
file<<obj.domm.year<<"."<<endl;
// cout<<"The date will be ="<<obj.domm.date<<" "<<obj.domm.month<<" "<<obj.domm.year<<"\n";
cout<<"Please enter the engion no alphabets.\n ";
cin>>obj.e1.engno.a;
file<<obj.e1.engno.a<<endl;
cout<<"Please enter the engion no numarics.\n ";
cin>>obj.e1.engno.nos;
file<<obj.e1.engno.nos<<endl;
// cout<<"The engion no will be ="<<obj.e1.engno.a<<obj.e1.engno.nos<<"\n";
cout<<"Please enter the Chasis no alphabets.\n ";
cin>>obj.e2.chs.a;
file<<obj.e2.chs.a<<endl;
cout<<"Please enter the Chasis no numarics.\n ";
cin>>obj.e2.chs.nos;
file<<obj.e2.chs.nos<<endl;
// cout<<"The Chasis no will be ="<<obj.e2.chs.a<<obj.e2.chs.nos<<"\n";
cout<<"Please enter the Registartion no alphabets.\n ";
cin>>obj.e3.a;
file<<obj.e3.a<<endl;
cout<<"Please enter the Registration no numarics.\n ";
cin>>obj.e3.nos;
file<<obj.e3.nos<<endl;
// cout<<"The Registation no will be ="<<obj.e3.a<<obj.e3.nos<<"\n";
cout<<"Please enter the Horse power.\n";
cin>>obj.hrspwr;
file<<obj.hrspwr<<endl;
cout<<"Please enter the Sitting capacity.\n";
cin>>obj.sitcap;
file<<obj.sitcap<<endl;
cout<<"********************************************************************************"<<endl;
cout<<"********************************************************************************"<<endl;
cout<<"You hoave enterd the following terms of data.\n"<<endl;
cout<<"********************************************************************************"<<endl;
cout<<"Date of manufacture.\tEngion no.\tChasis no.\tRedistration no.\n"<<endl;
cout<< obj.domm.date<<" "<<obj.domm.month<<" "<<obj.domm.year<<"\t "<<obj.e1.engno.a<<obj.e1.engno.nos<<"\t\t "<<obj.e2.chs.a<<obj.e2.chs.nos<<"\t "<<obj.e3.a<<obj.e3.nos<<"\n\n";
cout<<"Hourse power.\tSitting Capacity. \n\n";
cout<<obj.hrspwr<<"\t\t\t"<<obj.sitcap<<endl<<"\n\n";
cout<<"********************************************************************************"<<endl;
cout<<"********************************************************************************"<<endl;
file.close();
}
void output()
{
clrscr();
ve obj;
ifstream file;
file.open("sunshinelove.txt",ios::in);
file>>obj.domm.date>>obj.domm.month>>obj.domm.year;
cout<<"The date of manufactutre is given below.\n"<<obj.domm.date<<obj.domm.month<<obj.domm.year<<"\n";
file>>obj.domm.year;
file>>obj.e1.engno.a;
file>>obj.e1.engno.nos;
file>>obj.e2.chs.a;
file>>obj.e2.chs.nos;
file>>obj.e3.a>>obj.e3.nos;
file>>obj.hrspwr;
file>>obj.sitcap;
cout<<"You hoave enterd the following terms of data.\n"<<endl;
cout<<"********************************************************************************"<<endl;
cout<<"Date of manufacture.\tEngion no.\tChasis no.\tRedistration no.\n"<<endl;
cout<< obj.domm.date<<" "<<obj.domm.month<<" "<<obj.domm.year<<"\t "<<obj.e1.engno.a<<obj.e1.engno.nos<<"\t\t "<<obj.e2.chs.a<<obj.e2.chs.nos<<"\t "<<obj.e3.a<<obj.e3.nos<<"\n\n";
cout<<"Hourse power.\tSitting Capacity. \n\n";
cout<<obj.hrspwr<<"\t\t\t"<<obj.sitcap<<endl<<"\n\n";
cout<<"********************************************************************************"<<endl;
cout<<"********************************************************************************"<<endl;
/* cout<<"The date of manufactutre is given below.\n"<<obj.domm.date<<obj.domm.month<<obj.domm.year<<"\n";
cout<<"The engion no will be =\n"<<obj.e1.engno.a<<obj.e1.engno.nos<<"\n";
cout<<"The Chasis no will be =\n"<<obj.e2.chs.a<<obj.e2.chs.nos<<"\n";
cout<<"The Registration no will be =\n"<<obj.e3.a<<obj.e3.nos<<"\n";
cout<<"The Horse power will be\n"<<obj.hrspwr<<"\n";
cout<<"The Sitting capacity will be\n"<<obj.sitcap<<"\n"; */

file.close();
}
Please enclose your code within code blocks.
Topic archived. No new replies allowed.