#include #include using namespace std; struct items { char itemID[7]; char description[31]; float minbid; }; struct seller { char sellername[12]; char sellerID[3]; }; char itoa (int data); void charcat (char* data, char cat); int main() { items itemsData; seller sellerData; char id[3]; char answer; fstream binary; binary.open("seller_list.dat", ios::in | ios::binary); do { cout << "What is the sellers id?"; cin >> id; binary.read(reinterpret_cast(&sellerData), sizeof(sellerData)); int index = 0; bool found = false; int total = 0; while (index < 17 && !found) { binary.read(reinterpret_cast(&sellerData), sizeof(sellerData)); if (strcmp(id, sellerData.sellerID) == 0) { found = true; cout << sellerData.sellerID; cout << "How many items are you selling? "; cin >> total; for(int i = 0; i < total; i++) { strcpy(itemsData.itemID, sellerData.sellerID); strcat(itemsData.itemID, "00"); charcat(itemsData.itemID, itoa(i + 1)); cout << "What is a description for that item? "; cin >> itemsData.description; cout << "What is the minimum bid? "; cin >> itemsData.minbid; } } index++; } cout << "Do you want to enter for another seller(y/n)? "; cin >> answer; } while (answer == 'Y' || answer == 'y'); } char itoa (int data) { char i = (char)(0x30 + data); return i; } void charcat (char* data, char cat) { int i = strlen(data); data[i] = cat; data[i + 1] = '\0'; }