??????C++???????????????
??????????? ???????[ 2016/7/4 10:39:33 ] ????????.NET ???????????
????5.?????????????????
????д????????????????????????????this->number????????????????????????????????????????????????????????????????????飬???number?????????????????????顣???????????????????????????????:
????Set set1;
????set1.add_item(1);
????set1.add_item(2);
????set1.add_item(3);
????????set1?е?????items???[1??2??3]????????????????number=3?????????????????????set1????????20?????????????number=3???????????set1.items[number]=20????????number+1??????????λ?????number=4??????????????????number???????set1.number=50;??????????number???????????????????λ????????????????????????????number?Ч??????????????????鱾????????????????????number??????л??????????????????????:
class Set
{
public:
//????????????????
Set() {
this->number = 0;
memset(this->items??0??sizeof(items));
}
//?????????
int init(int items[]?? int num);
//??????
bool add_item(int item);
//??????
int remove_item(int item);
//????????
Set operator+ (Set set2);
//????????
Set operator* (Set set2);
//??????????
int display();
//?ж?????????????item???????????????е?λ????????????-1
int is_exist(int item);
private:
int items[100]; //?????????????????????100?????????
int number; //????????i????????????????
};
????6. ?????????????
????bool Set::remove_item(int item)
????{
????int pos = is_exist(item);
????if(pos == -1) return false;
????for(int i=pos; i< this->number-1; i++) {
????this->items[i] = this->items[i+1];
????}
????this->number--;
????return true;
????}
??????????????????????????????????????????????????false;??Σ???λ????????????λ??????????λ?????????????????????????????????????-1????????true.
????7. ??????????????
????Set Set::operator* (Set set2)
????{
????Set result;
????for(int i=0; i< this->number; i++) {
????if(set2.is_exist(this->items[i]) >= 0) {
????result.items[result.number] = this->items[i];
????result.number++;
????}
????}
????return result;
????}
???????????????????A?е?????????A?е?????????ж??????B???????????????????????C???У????????C
????8. ??????????????
Set Set::operator+ (Set set2)
{
Set result;
for(int i=0; i<this->number; i++) {
result.items[result.number] = this->items[i];
result.number++;
}
for(int j=0; j<set2.number; j++) {
if(result.is_exist(set2.items[j]) == -1) {
result.items[result.number] = set2.items[j];
result.number++;
}
}
return result;
}
???????????????A????????A?е??????????????C???У???????????B??????B?е??????????????ж??????A?д????????????????????????C?У?????????C
???????????????????????漰???????????????????SPASVOС??(021-61079698-8054)?????????????????????????
??????
??C++????????????C++ lvalue??rvalueC++11????????C++???????????????C++?е?????????????????C++?????????C++???Windows????λ??C/C++???????????????????JAVA??C??C++??????????c++??python???????????????????????????????C++???????C++?е????????C++????????????????C++ ???????????????C++?????????????????????C++????????????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11????????
?????????App Bug???????????????????????Jmeter?????????QC??????APP????????????????app?????е????????jenkins+testng+ant+webdriver??????????????JMeter????HTTP???????Selenium 2.0 WebDriver ??????