hello,
I have a text file that looks like this:
text
numbers
text
numbers
text
numbers
..
..
..
I figure out how to get the "numbers" line into the double variable I
have created. I have erased all attempts, because they didn't work. I
hope I have made enough sense of what I am trying to do.
Here is my code:
#include <iostream>
#include <fstream>
using namespace std;
struct type
{
string item;
double price;
};
int main()
{
type list[16];
int i;
ifstream infile;
infile.open( "c:\\stuff.txt" );
while( !infile.eof() )
{
for( int i = 0; i < 16; i++ )
{
getline( infile, list[i].item );
}
}
return 0;
}