My loop keeps on repeating inspite of typing N=1.
here is the code..
void club::enterdata () {
std::cout<<"Ent er details";
std::cin>>mno>> memname>>activi ty;
this is the function... and this is the funcion in which this function is called..
void club::writeinto ()
{
club c{};
int N, i = 0;
std::ofstream fout( "project.da t", std::ios::binar y );
if( ! fout )
{
std::cout<<"Err or";
}
while(!fout.eof ())
{
std::cout << "Enter the number of records to be entered";
std::cin >> N;
for(i=0;i<=N;i+ +) {
c.enterdata();
}
fout.write( (char*)&c, sizeof(c) );
}
fout.close();
}
here is the output..
Enter the number of records to be entered 1
Enter details 12 hka abc
Enter details
Pls help me out..
here is the code..
void club::enterdata () {
std::cout<<"Ent er details";
std::cin>>mno>> memname>>activi ty;
this is the function... and this is the funcion in which this function is called..
void club::writeinto ()
{
club c{};
int N, i = 0;
std::ofstream fout( "project.da t", std::ios::binar y );
if( ! fout )
{
std::cout<<"Err or";
}
while(!fout.eof ())
{
std::cout << "Enter the number of records to be entered";
std::cin >> N;
for(i=0;i<=N;i+ +) {
c.enterdata();
}
fout.write( (char*)&c, sizeof(c) );
}
fout.close();
}
here is the output..
Enter the number of records to be entered 1
Enter details 12 hka abc
Enter details
Pls help me out..
Comment