Thank you everyone. We were able to progress.
However I am unable to append file.
I put the app while opening the filing but it is not happening still.
Actually each time a user opens the code to enter data the no, of house and families should become the older values plus new which the user is going the enter.
If i already have 3 houses, next time i open and say "No .of enteries =2" it should become 5.
But it displays 2 only.
It is not counting the enteries which are already present.
Can you please help in this regard.Below is my modified program.
using namespace std;
static int NumOfHouses; //global variable for number of houses
static int NumOfVehicles; //global variable for number of vehicles
int NumOfMem; //no. of members in a family
int Hno; //house number
int NumOfFamilies; //no. of families
Community() //Default constructor
class Transport:public Community
int NumOfVehicles1; //no. of veicles owned
char Type; //type could be four/two wheeler
Transport() //default constructor
cout<<"Enter house number:";
cout<<"Enter number of members in family:";
cout<<"\nLatest count of Number of families is:"<<NumOfHouses;
cout<<"No. of vehicles owned:";
cout<<"Type of vehicles:\n";
cout<<i+1<<" Vehicle type:";
cout<<"\nLatest count of Vehicles is:"<<NumOfVehicles;
cout<<"\nERROR IN OPENING FILE";
if(!fout1) //checking if file is opened
cout<<"\nError occured in opening file";
cout<<"\nPlease try again";
cout<<"\nNo of records:"; //entry for records
cout<<"\n\nData recorded to file";
Line 38: strcpy_s(Type,"Four Wheeler");
Type is only 10 characters. You're trying to copy a 12 character string into string that can only hold 10 characters. You should consider using std::string instead of a C string.
Line 61: cin.getline(Type,30);
You're trying to read in up to 30 characters into a 10 character string.
Line 69: main() must be type int.
PLEASE ALWAYS USE CODE TAGS (the <> formatting button) when posting code.
It makes it easier to read your code and also easier to respond to your post. http://www.cplusplus.com/articles/jEywvCM9/
Hint: You can edit your post, highlight your code and press the <> formatting button.