题目
代码
#include <iostream>
#include "ObjMgt.h"
#include <vector>
using namespace std;
struct Object{
unsigned int key1;
unsigned int key2;
unsigned int key3;
Object(unsigned int a,unsigned int b,unsigned int c){
key1 = a;
key2 = b;
key3 = c;
}
Object(){}
};
vector<Object> container;
int AddObject (unsigned int key1, unsigned int key2, unsigned int key3){
int isExits = IsObjectExist(key1,key2,key3);
if(isExits){
return -1;
}
Object o(key1,key2,key3);
container.push_back(o);
return 0;
}
void DeleteObject (unsigned int key1, unsigned int key2, unsigned int key3){
Object o;
vector<Object>::iterator ite = container.begin();
while(ite != container.end()){
o = *ite;
if((o.key1 == key1 || key1 == 0xFFFFFFFF) && (o.key2 == key2 || key2 == 0xFFFFFFFF) && (o.key3 == key3 || key3 == 0xFFFFFFFF)){
ite = container.erase(ite);
}
else{
++ite;
}
}
return ;
}
int IsObjectExist (unsigned int key1, unsigned int key2, unsigned int key3){
int size = container.size();
Object o;
for(int i = 0;i < size;++i){
o = container[i];
if(o.key1 == key1 && o.key2 == key2 && o.key3 == key3){
return 1;
}
}
return 0;
}
void Clear(void){
container.clear();
return;
}
<script type="text/javascript">
$(function () {
$('pre.prettyprint code').each(function () {
var lines = $(this).text().split('\n').length;
var $numbering = $('<ul/>').addClass('pre-numbering').hide();
$(this).addClass('has-numbering').parent().append($numbering);
for (i = 1; i <= lines; i++) {
$numbering.append($('<li/>').text(i));
};
$numbering.fadeIn(1700);
});
});
</script>
分享到:
相关推荐
华为机试一霸教你过华为机试演讲稿..pdf
华为OD机试(..75.rar
华为机试真题(非牛客网试练题)OD考试真题,不定期更新,文档含代码解答
华为机试一霸教你过华为机试.doc
华为机试一霸教你过华为机试。大菊厂招聘有三关,心理测试,机试,面试。
。。。
。。。
华为机试算法题总结 经验分享
华为机试oj练习题2014
华为机试一霸教你过华为机试e-18页.pdf
华为OD系列--华为OD机试
华为机试题目100题练习题
本人在准备2014年华为机试的时候,进行整理的,代码全部运行成功。如有错误,请大家见谅。
华为机试成功归来,与小伙伴们分享下经验
大师兄教你如何过华为机试
华为机试.md
里面有几十道华为历届考过的机试题,可供大家研究和参考,主要是里面的思想,只要理解透了里面的思想,非常有助于机试。
贰壹贰叁零华为OD机试.pptx 华为OD机试.pptx 华为OD机试.pptx
华为机试.py
2014重邮华为机试(2013.9.14和2013.9.15)一共三场的题目