Can anyone please show me whats going wrong here.
I'm trying to access a structure from within another structure but am recieving errors.
Structures are global and are as follows:
The 'stock' array is already populated.
My code is as follows:
MY compile log is as follows:
cout << "Enter item number purchased: ";
cin >> item;
item -= 1;
/*line 213*/ bill.stock = stock[item];
cout << "Weight: ";
cin >> bill.weight;
bill.cost = stock[item].price * bill.weight;
void print_bill ( BillLine bill_line, int num_bill_items )
for (int i=0; i<num_bill_items; ++i)
/*line 240*/ cout << "Name = " << bill_line[i].stock.desc << endl;
cout << "Weight = " << bill_line[i].weight << endl;
cout << "Cost = " << bill_line[i].cost << endl;
Compiler: Default compiler
g++.exe "C:\Ged\code\assignment\best.cpp" -o "C:\Ged\code\assignment\best.exe" -g3 -O0 -g3 -I"C:\Ged\Dev-Cpp\include\c++" -I"C:\Ged\Dev-Cpp\include\c++\mingw32" -I"C:\Ged\Dev-Cpp\include\c++\backward" -I"C:\Ged\Dev-Cpp\include" -L"C:\Ged\Dev-Cpp\lib"
C:/Ged/code/assignment/best.cpp: In function `BillLine bill_item()':
C:/Ged/code/assignment/best.cpp:213: incompatible types in assignment of `
StockItem' to `StockItem'
C:/Ged/code/assignment/best.cpp: In function `void print_bill(BillLine*, int)':
C:/Ged/code/assignment/best.cpp:240: request for member `desc' in `(bill_line +
(+(i * 3508)))->BillLine::stock', which is of non-aggregate type `