reading from file

I am having trouble reading from the file. I cannot seem to understand what is going on with it, can anyone help?

#include <iostream>
#include <iomanip>
#include <string>
#include <fstream>

using namespace std;


struct menuItemType
{
string menuItem;
double menuPrice;

};
string menuItem;
double menuPrice;
int main()
{
ifstream in;
ifstream out;
in.open("week9input.txt");
out.open("week9output.txt");


}
{

while (!in.eof())
{
int i = 0;
getline>>menuItem[i];
in>> menuPrice[i];

cout<< menuItem[].menuItem<<" " << menuPrice[].menuPrice<< " "<<endl;

++i;
}

}
I might be wrong but I believe you are using getline incorrectly. It should be something like:
 
 getline(in,menuItem[I]);
Topic archived. No new replies allowed.