Declaration Error, C++

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Kindle Life 123
    New Member
    • May 2018
    • 7

    Declaration Error, C++

    I have typed in a function,but it shows declaration error.

    here is the function:

    void writeinto()
    {
    club c;
    int N,i;
    {
    ofstream fout("project.d at",ios::binary );
    {
    if(!fout)
    {
    cout<<"Error";
    exit(0);
    }
    while(!fout.eof ())
    {
    cout<<"Enter the number of records to be entered";
    cin>>N;
    {for(i=0;i<N;i+ +)
    c.enterdata();
    fout.write((cha r*)&c,sizeof(c) );
    }
    fout.close();
    }}}
  • weaknessforcats
    Recognized Expert Expert
    • Mar 2007
    • 9214

    #2
    What was the error?

    I assume you have #included declarations for club, iostream.

    and you are using namespace std.

    Comment

    • Kindle Life 123
      New Member
      • May 2018
      • 7

      #3
      My compiler is turbo c++ 4.5. So it runs without namespace std.
      the error is not specified.
      Should I include void club::writeinto ()?

      Comment

      • Kindle Life 123
        New Member
        • May 2018
        • 7

        #4
        Thanks a ton for all your efforts...

        Comment

        Working...