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