• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

HELP! Any C++ experts out there?

mosdef

Banned
Any C++ experts out there that I could speak online with about a program I'm struggling with? Thanks.

-mosdef
 
What are you having trouble with?

You might wanna post your problem here so more ppl can give you feedbacks...
 
Ok I figured out what the problem is, but how should I solve it? I'm reading in characters from a file.

while( !inAirlines.eof() )
{
...
}

Will this detect eof? Also, what's the best way to get to the next line in the file?

-mosdef
 
ifstream instream;

string s;

vector<string> storage;
int i =0;

instream.open(dafilename.c_str())

if (instream.fail())
{
cout << &quot;the file was unable to be opened&quot;;
return;
}

while(!instream.fail())
{
storage.push_back(s);

getline(instream,s);
i++;
}

instream.close;



for (int x=0; x <=instream.size(); x++)
{
cout << storage[x] << endl;
}


return;
}

 
Back
Top