我有我整个程序的这个片段。在这个函数中,特别是这段程序中,用户输入一个 MLS# 来从阵列中删除一个家。第一个“for”语句搜索 MLS#,然后搜索 null 的所有数据。我在下一个“for”语句中遇到问题。索引清空后将所有数据向左移动。struct数组中存储的数据如下:
struct mlsListing { int mlsNum;           // Struct Array holds one line of the struct
                    double price;         // mlsListing 
                    int type; 
                    string zip; 
                    string company; 
                    string realty; 
                  }; 
 const int MAX_LISTINGS = 750;  
        mlsListing houseData[MAX_LISTINGS]; 
 const int NOT_FOUND = -1;
 int targetMLS; // Variable for target MLS
 int mlsDelete; // Variable for target MLS found
 int mlsCounter;// Counter for finding target MLS 
 int count;     // Array Counter
// Function 
void {
 cout << "Enter the MLS# you wish to delete: "; 
           cin >> targetMLS;                       // User input MLS#
        for (mlsCounter = 0; ((mlsCounter < count) && (mlsDelete == NOT_FOUND));
                                 mlsCounter++) {
                 if (houseData[mlsCounter].mlsNum == targetMLS) {
                    mlsDelete = houseData[mlsCounter].mlsNum; 
                    houseData[mlsCounter].mlsNum = 0; 
                    houseData[mlsCounter].price = 0;
                    houseData[mlsCounter].type = 0;
                    houseData[mlsCounter].zip.clear(); 
                    houseData[mlsCounter].company.clear();
                    houseData[mlsCounter].realty.clear(); 
                  }
          }
         // Shifting indices to the left after deletion?
          for (move = mlsCounter;move < count; move++){
              houseData[move].mlsNum = houseData[move+1].mlsNum; 
              houseData[move].price = houseData[move+1].price; 
              houseData[move].type = houseData[move+1].type; 
              houseData[move].zip = houseData[move+1].zip; 
              houseData[move].company = houseData[move+1].company;
              houseData[move].realty = houseData[move+1].realty;  
          } 
         count--; 
}