possible improper syntax with filling a structure
Dec 10, 2013 at 10:18pm UTC
I'm getting a "field .. cannot be resolved" message. Perhaps I'm not using the proper syntax? Do I need to declare the structure in main before I can fill it in a separate function? Thanks!
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
struct product
{
int id_number[MAX_PRODUCTS];
char name[SIZE];
double cost[MAX_PRODUCTS];
int reorder_level[MAX_PRODUCTS];
int reorder_amt[MAX_PRODUCTS];
};
bool GetMaster (product[]){
bool file_is_open;
ifstream input_file ("ECWMaster.txt" );
while (input_file){
for (int data_getter = 0; data_getter < MAX_PRODUCTS; data_getter++){
input_file >> product.id_number[data_getter] >> product.name[data_getter] >> product.cost[data_getter] >>
product.reorder_level[data_getter] >> product.reorder_amt[data_getter];
}
}
if (input_file){
file_is_open = true ;
}
return file_is_open;
}
Topic archived. No new replies allowed.