我的节目模拟一个视频储存。 我的名单上有多份录像。 如果我试图租用一个录像带,名单上第一个录像带已经租用,那么我的节目就无法继续检查其他复印件是否可用(如果黄玉米为0,则有一部电影)。 从名单上找到成员,以便更好地了解描述什么是:
谁能看一看,让我知道他们是否发现一个问题? 感谢任何帮助。
www.un.org/Depts/DGACM/index_spanish.htm 主要
try
{
int index = 0;
bool found = false;
while (!found)
{
if (strncmp(filmId,filmList.getAt(index).number,6) == 0 && strncmp("0000",filmList.getAt(index).rent_id,5) == 0)//If that film is rented by NO customer
{
found = true;//customer can rent it
strcpy(newItem.number,filmId);//copy filmId into newItem
filmList.retrieve(newItem);//copy the struct in our orderedList with the same filmId/copy into newItem
filmList.remove(newItem);//delete the struct with same filmId/copy as newItem from the orderedList
strcpy(newItem.rent_id,custId);//update info in
strcpy(newItem.rent_date,rentDate);// newItem to show
strcpy(newItem.return_date,dueDate);// that it has been rented
filmList.insert(newItem);//put NewItem into list, effectivily replacing the removed item.
cout << "Rent confirmed!" << endl;
}
else
{
if (strncmp(filmId,filmList.getAt(index).number,6) > 0 || strncmp("0000",filmList.getAt(index).rent_id,5) > 0)
{
++ index;
}
else
{
throw string ("Not in list");
}
}
}
}
catch (string s)
{
cout << "
***Failure*** " << s << endl;
}
让我知道,该方案的任何其他部分是否需要更多的法典。