Need help with this Program, why won't it work?

#include<cstdlib>
#include<iostream>
#include<fstream>
#include<iomanip>
using namespace std;

int main()
{
int seat[6][38];
int k, n;
ifstream myfile;
myfile.open("C://Users//JoshNichols//Documents//Willow International//Programming//flight.txt");
for(n=0; n<38; n++)
for(k=0;k<6; k++)
{
myfile>>seat[k][n];
}
myfile.close;
cout<<setw(5)<<"AVAILABLE SEATS"<<endl;
cout<<"ROW"<<setw(4)<<"SEATS"<<endl;
for(n=0; n<38; n++)
for(k=0;k<6; k++)
{
if(seat[k][n]==0 && seat[k+1][n]==0 && k!=2 && k!=5)
cout<<n<<setw(5)<<k<<", "<<k+1<<endl;
else
cout<<n<<setw(3)<<"No seats available"<<endl;
}
system("PAUSE");
return 0;
What's the problem? Surely you're getting some kind of error message...
yeah
1>------ Build started: Project: ConsoleApplication1, Configuration: Debug Win32 ------
1> Source.cpp
1>c:\users\joshnichols\documents\consoleapplication1\consoleapplication1\source.cpp(18): error C3867: 'std::basic_ifstream<_Elem,_Traits>::close': function call missing argument list; use '&std::basic_ifstream<_Elem,_Traits>::close' to create a pointer to member
1> with
1> [
1> _Elem=char,
1> _Traits=std::char_traits<char>
1> ]
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
If you edit your post so it uses code tags - the <> button on the right - we can see which line number is the error.

Figured it out:

myfile.close();

compiler wrote:
function call missing argument list


Advice about code tags still applies (always) though.
Last edited on
Topic archived. No new replies allowed.