>int main ();
Remove the semicolon.
>while (! " with\ "reed".aof"());
I can't imagine what you're trying to do here, but it's probably this:
while ( !reed.eof() )
You don't want to close the file in the loop that reads it. Also, using eof() as a loop condition is a bad idea. It would be better for getitem to return a success or failure flag and use that as the loop condition.
Narue
Bad Cop
15,460 posts since Sep 2004
Reputation Points: 6,464
Solved Threads: 1,401
>with\ is a folder, notsure if its posible too
It's not possible the way you're doing it.
Narue
Bad Cop
15,460 posts since Sep 2004
Reputation Points: 6,464
Solved Threads: 1,401
Do yourself a favor, never write a whole program and then try to debug it. You'll just drive yourself crazy. Start like this:
#include <iostream> // includes iostream
#include <fstream> // ellows the program to write and reed files
#include <string>
using namespace std;
int main ();
{
return 0;
}
when that compiles and runs as expected then go to this:
#include <iostream> // includes iostream
#include <fstream> // ellows the program to write and reed files
#include <string>
using namespace std;
int main ()
{
string item; //what item
item = input1);
return 0;
}
When you get that to compile and run , then add another line or two and keep repeating.
That doesn't mean you shouldn't write out the flow of the program or even some psuedocode for the whole program at once--you should. But with the actual code, go in ministeps, at least until you have a fair amount of experience.
Lerner
Nearly a Posting Maven
2,382 posts since Jul 2005
Reputation Points: 739
Solved Threads: 396