void Record::Update() {
string choice;
cout << "Enter ID: " << endl;
cin >> IDValue;
for(Itr = List.begin() ; Itr !=List.end() ; Itr+) {
if(Itr->GetID() == IDValue)
{
cout << Transit->GetID() << endl;
cout << "Would you like to set Name ? (y/n) :";
cin >> choice;
if (choice == 'y')
cin >> strName;
Itr->SetName(strName);
cout << Itr->GetName() << endl;
cout << Itr->GetLocation() << endl;
}
}
}
该函数通过其唯一的ID号查找记录。每个新记录都有一个ID号码。如果我输入ID 2,则该功能会显示ID为2的记录。如何修改记录的某个属性?在这种情况下,它的位置。向量中的更新值
谁知道。这个容器中存储了哪些类型的对象,并允许您修改位置? – 2010-11-22 02:24:58
你有增变器方法吗? 'Transit-> SetID(9)'会起作用吗? – 2010-11-22 02:25:49
我讨厌它,当你创建一个新的帐户,每次你问问题:* http://stackoverflow.com/questions/3860271 * http://stackoverflow.com/questions/4108853 – 2010-11-22 02:38:47