这篇教程C++ GetElem函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中GetElem函数的典型用法代码示例。如果您正苦于以下问题:C++ GetElem函数的具体用法?C++ GetElem怎么用?C++ GetElem使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了GetElem函数的26个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: GetElembool GeneralMatrix::ExchangeRows(int iRow1,int iRow2) const{ int j; ELEMTYPE temp; if(this->nRow()<2||iRow1==iRow2) return TRUE; if(iRow1>=nRow()||iRow2>=nRow()) return FALSE; for(j=0;j<nCol();j++) { temp = GetElem(iRow1,j); GetElem(iRow1,j) = GetElem(iRow2,j); GetElem(iRow2,j) = temp; }return TRUE; }
开发者ID:caomw,项目名称:sketch-based-modeling-qt,代码行数:20,
示例2: Zerobool GeneralMatrix::MakeUnit() const{ if(nRow()!=nCol()) return FALSE; Zero(); for (int i=0;i<nRow();i++) GetElem(i,i) = 1.0;return TRUE; }
开发者ID:caomw,项目名称:sketch-based-modeling-qt,代码行数:12,
示例3: unionLvoid unionL(SqList *La,SqList Lb){ ElemType e; int La_len=ListLength(*La); int Lb_len=ListLength(Lb); for (int i=1;i<=Lb_len;i++) { GetElem(Lb,i,&e); if (!LocateElem(*La,e)) ListInsert(La,++La_len,e); }}
开发者ID:SuooL,项目名称:LearnDataStructureAndAlgorithms,代码行数:12,
示例4: Unionvoid Union(List &La, List Lb) { // 算法2.1 // 将所有在线性表Lb中但不在La中的数据元素插入到La中 int La_len,Lb_len,i; ElemType e; La_len = ListLength(La); // 求线性表的长度 Lb_len = ListLength(Lb); for (i=1; i<=Lb_len; i++) { GetElem(Lb, i, e); // 取Lb中第i个数据元素赋给e if (!LocateElem(La, e, equal)) // La中不存在和e相同的数据元素 ListInsert(La, ++La_len, e); // 插入 }} // union
开发者ID:PengJi,项目名称:Data-Structure,代码行数:12,
示例5: VectorGeneralMatrix GeneralMatrix::GetColVector(int iCol) const{ int i; GeneralMatrix Vector(nRow(),1,ERRORVAL); if(iCol<0||iCol>nCol()-1||nRow()==0) return Vector; for(i=0;i<nRow();i++) Vector[i][0] = GetElem(i,iCol); return Vector;}
开发者ID:caomw,项目名称:sketch-based-modeling-qt,代码行数:12,
示例6: CHECK_POINTER/*************************************************************************** name : FindElem* description: 查找元素* input : pszElemName 待查找的元素名* output : NA* return : true - 成功,false - 失败* remark : NA**************************************************************************/bool CXml::FindElem(const char *pszElemName){ CHECK_POINTER(pszElemName, false); CHECK_POINTER(m_pXmlNode, false); TiXmlNode* pTmpNode = m_pXmlNode; // 将指针指向第一个元素 m_pXmlNode = m_pXmlNode->Parent()->FirstChild(); // 判断指针是否为空 CHECK_POINTER(m_pXmlNode, false); m_pXmlElem = m_pXmlNode->ToElement(); // 增加一个变量检查控制情况 const char* pChkTmpNode = NULL; while (((pChkTmpNode = GetElem()) != NULL) && (0 != strcmp(pszElemName, pChkTmpNode))) //lint !e838 { if (NULL == m_pXmlNode->NextSibling()) { break; } m_pXmlNode = m_pXmlNode->NextSibling(); m_pXmlElem = m_pXmlNode->ToElement(); }/* while (0 != strcmp(pszElemName, GetElem())) { if (NULL == m_pXmlNode->PreviousSibling()) { return false; } m_pXmlNode = m_pXmlNode->PreviousSibling(); m_pXmlElem = m_pXmlNode->ToElement(); }*/ const char* pNextTmpElem = this->GetElem(); CHECK_POINTER(pNextTmpElem, false); if (0 == strcmp(pszElemName, pNextTmpElem)) { return true; } // 如果找不到匹配节点,指针还原 m_pXmlNode = pTmpNode; m_pXmlElem = m_pXmlNode->ToElement(); return false;}
开发者ID:eSDK,项目名称:esdk_elte,代码行数:60,
示例7: powELEMTYPE GeneralMatrix::Distance_E(GeneralMatrix& other) const{ int i,j; ELEMTYPE result = ERRORVAL; if(nRow()!=other.nRow()||nCol()!=other.nCol()) return result; for(result=0,i=0;i<nRow();i++) for(j=0;j<nCol();j++) result += pow(GetElem(i,j)-other[i][j],2);return sqrt(result);}
开发者ID:caomw,项目名称:sketch-based-modeling-qt,代码行数:13,
示例8: GetPowerSetvoid GetPowerSet(int i, List A, List &B) { // 算法6.15 // 线性表A表示集合A,线性表B表示幂集ρ(A)的一个元素。 // 局部量k为进入函数时表B的当前长度。 // 第一次调用本函数时,B为空表,i=1。 ElemType x; int k; if (i > ListLength(A)) Output(B); // 输出当前B值,即ρ(A)的一个元素 else { GetElem(A, i, x); k = ListLength(B); ListInsert(B, k+1, x); GetPowerSet(i+1, A, B); ListDelete(B, k+1, x); GetPowerSet(i+1, A, B); }} // GetPowerSet
开发者ID:PengJi,项目名称:Data-Structure,代码行数:13,
示例9: ListInsert// replace element of position index, so original element will toward backbool ListInsert(pListHeader plh, unsigned int index, pListNode pNode){ if(index > plh->ListSize) ErrorFunc("Too much bigger index!/n", OUT_OF_SCOPE); pListNode pRplcedNode = GetElem(plh, index); pListNode pPriorNode = PriorElem(plh, pRplcedNode); pNode->next = pPriorNode->next; pPriorNode->next = pNode; (plh->ListSize)++; return true;}
开发者ID:chinabin,项目名称:DSAA,代码行数:15,
示例10: LinkToElementsPenaltyvoid Constraint::LinkToElements() { if (UsePenaltyFormulation()) //in penalty formulation, the SOS-DOF are hired from constrained elements { LinkToElementsPenalty(); } else { for (int i = 1; i <= NE(); i++) //$ DR 2012-11-02: changed elements.Length() to NE(), because some constraints add element(2) = 0 for ground joints, NE() returns the correct value for these constraints { GetElem(i).AddConstraint(this,i); } }}
开发者ID:AlexeySmolin,项目名称:LIGGGHTS-MCA,代码行数:14,
示例11: mainvoid main(){ int *e; Linklist L; e=(int *)malloc(sizeof(int)); L=(Linklist)malloc(LEN); Init_Link(L); Show_Link(L); Insert_List(L,17,2); Show_Link(L); GetElem(L,2,e); printf("%d/n",*e); free(e);}
开发者ID:weekihowyee,项目名称:shujujiegou2016,代码行数:14,
示例12: Show_Elem/*====================================================================* 操作目的: 输出顺序表中的元素** 初始条件: 线性表L已存在** 操作结果: 输出了顺序表中的元素** 函数参数:* SeqList *L 线性表L** 返回值:* 无======================================================================*/void Show_Elem(SeqList *L){ int i; DataType e; for(i = 0; i < L->length; i++) { if(GetElem(*L, i+1, &e) == false) { fprintf(stderr,"输出失败!/n"); exit(EXIT_FAILURE); } printf("%4d", e); }}
开发者ID:astrotycoon,项目名称:ADT,代码行数:27,
示例13: unionLvoid unionL(SqList *La, SqList Lb) /* union Lb to La */{ int La_len, Lb_len, i; ElemType e; La_len = ListLength(*La); Lb_len = ListLength(Lb); for (i = 1; i <= Lb_len; ++i) { GetElem(Lb, i, &e); if (!LocateElem(*La, e)) ListInsert(La, ++La_len, e); } }
开发者ID:benbee,项目名称:Learning,代码行数:14,
示例14: Unionvoid Union(SqList &La, SqList &Lb){//将所有在线性表Lb中但不在La中的数据元素插入到La中 ElemType e; //int La_len, Lb_len; int i; //La_len = ListLength(La); //Lb_len = ListLength(Lb); for ( i = 1; i <= Lb.length; i++ ) { GetElem(Lb, i, e); if ( !LocateElem(La, e, equal) ) ListInsert(La, ++La.length, e); }}
开发者ID:kobemiller,项目名称:DataStructure,代码行数:15,
示例15: DelElem//#endif//********************************************************************//删除A中出现B的元素的函数实现void DelElem(SeqList *A,SeqList B){ int i,flag,pos; DataType e; for(i=0;i<B.length;i++) { flag=GetElem(B,i,&e);//依次把B中每个元素取出给 if(flag==1) { pos=LocateElem(*A,e);//在A中查找和B中取出的元素e相等的元素 if(pos>0) DeleteList(A,pos,&e);//如果找到该元素,将其从A中删除 } }}
开发者ID:pengfeifan,项目名称:JustForTest,代码行数:18,
示例16: mainint main() { student s; SqList L; InitList_Sq(L); s.score = 60; s.boy = true; ListInsert_Sq(L, 1, s); s.score = 70; s.boy = false; ListInsert_Sq(L, 1, s); s.score = 90; s.boy = false; ListInsert_Sq(L, 2, s); int n = Length(L);// int n = L.length; for (int i = 1; i <= n; i++) { GetElem(L, i, s); std::cout << s.score << " " << s.boy << "/n"; } ListDelete_Sq(L, 1, s); std::cout << "删除的1号元素是:"<<s.score << " " << s.boy << "/n"; n = Length(L); for (int i = 1; i <= n; i++) { GetElem(L, i, s); std::cout << s.score << " " << s.boy << "/n"; } double average_score = 0; for (int i = 1; i <= n; i++) { GetElem(L, i, s); average_score += s.score; } average_score /= n; std::cout << "平均分是" << average_score << "/n"; return 0;}
开发者ID:cheng-guo,项目名称:shdong,代码行数:36,
示例17: GetElemicSigBRDFFunction CIccStructBRDF::GetBRDFFunction() const{ CIccTag* pTag = GetElem(icSigTypeBrdfMember); if (pTag) { if (pTag->GetType() == icSigSignatureType) { CIccTagSignature* pTagSig = dynamic_cast<CIccTagSignature*>(pTag); if (pTagSig) return (icSigBRDFFunction)pTagSig->GetValue(); } } return (icSigBRDFFunction)icSigUnknownType;}
开发者ID:ramzes2,项目名称:RefIccMAX,代码行数:15,
示例18: union_funcvoid union_func(SqList *La, SqList Lb){ int La_length, Lb_length, i; ElemType e; La_length = ListLength(*La); Lb_length = ListLength(Lb); for( i=1; i <= Lb_length; i++) { GetElem(Lb, i, &e); if( !LocateElem(*La, e) ) { ListInsert(La, ++La_length, e); } }}
开发者ID:youngchou1997,项目名称:cbook,代码行数:15,
示例19: whilensIContent*IDRefsIterator::NextElem(){ while (true) { const nsDependentSubstring id = NextID(); if (id.IsEmpty()) break; nsIContent* refContent = GetElem(id); if (refContent) return refContent; } return nsnull;}
开发者ID:gorakhargosh,项目名称:mozilla-central,代码行数:15,
示例20: Printvoid GeneralMatrix::Print(){ if (nRow()==0||nCol()==0) { return; } for (int i=0;i<nRow();i++) { for (int j=0;j<nCol();j++) { cout<<GetElem(i,j)<<" "; } cout<<endl; } cout<<endl;}
开发者ID:caomw,项目名称:sketch-based-modeling-qt,代码行数:16,
示例21: Union1void Union1(Sqlist &La, Sqlist &Lb){ ElemType e; int i; int la_len, lb_len; la_len = ListLength(La); lb_len = ListLength(Lb); for ( i = 1; i <= lb_len; i++ ) { GetElem(Lb, i, e); printf("e = %d/n", e); if ( !LocateElem(La, e, equal) ) ListInsert_before(La, ++la_len, e); }}
开发者ID:kobemiller,项目名称:mycode,代码行数:16,
示例22: unionLvoid unionL(sqList *La,sqList Lb){ int La_len,Lb_len,i; ElemType e; La_len =ListLength(*La); Lb_len =ListLength(Lb); for (i=1; i< Lb_len;i++) { GetElem(Lb,i,&e); if(!LocateElem(*La,e)) { ListInsert(La,++La_len,e); } }}
开发者ID:kkmetsky,项目名称:Learn_DataStructures,代码行数:16,
示例23: InsertDList//在双向循环链表的第i个位置插入元素e。插入成功返回1,否则返回0int InsertDList(DLinkList head,int i,char e){ DListNode *p,*s; p=GetElem(head,i); //查找链表中第i个结点 if(!p) return 0; s=(DListNode *)malloc(sizeof(DListNode)); if(!s) return -1; s->data=e; //将s结点插入到双向循环链表 s->prior=p->prior; p->prior->next=s; s->next=p; p->prior=s; return 1;}
开发者ID:pengfeifan,项目名称:JustForTest,代码行数:17,
示例24: DelElemvoid DelElem(SeqList *A, SeqList B){ int i, pos; DataType e; for(i = 0; i < B.length; i++) { if(GetElem(B, i + 1, &e)) /* 依次把B中的每个元素取出来 */ { if( (pos = LocateList(*A, e, compare )) >= 1) ListDelete(A, pos, &e ); } }}
开发者ID:astrotycoon,项目名称:ADT,代码行数:16,
示例25: mainint main(){ SqList L; printf("%ld/n",sizeof(L)); InitSqList(L); int i; for(i=0;i<20;++i) push_back(L,i); Display(L); printf("L.length :%d/n",L.length); printf("listlength:%d/n",ListLength(L)); Elem e,prio,next; GetElem(L,2,e); PriorElem(L,prio,e); NextElem(L,next,e); printf("the number 2 tumple:%d/n",e); printf("prio e:%d/n",prio); printf("next e:%d/n",next); ListInsert(L,8,10000); Display(L); LocateList(L,10000); DeleteK(L,5,3); Display(L); DestroyList(L); printf("size of a.length :%d/n",L.listsize); if(ListEmpty(L)) printf("empty!/n"); /*char* p = NULL; p=(char*)malloc(10*sizeof(char)); if(p==NULL) { printf("filure"); exit(1); } printf("%p/n",p); strcpy(p,"abc"); printf("%c/n%c/n%c/n",*p,*p+1,*p+2); printf("%p/n%p/n",p,p+1); //if(p!=NULL) free(p); //p=NULL; //DestroyList(L); //Display(L);*/ return 0;}
开发者ID:lichao111,项目名称:Hello-world,代码行数:47,
示例26: ListDeletevoid ListDelete(pListHeader plh, unsigned int index){ pListNode pNode = GetElem(plh, index); pListNode tmp = pNode; if(index == 1) { plh->next = pNode->next; } else { pListNode pPriorNode = PriorElem(plh, pNode); pPriorNode->next = pNode->next; } free(tmp); (plh->ListSize)--;}
开发者ID:chinabin,项目名称:DSAA,代码行数:17,
注:本文中的GetElem函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ GetElementStarShip函数代码示例 C++ GetElapsedTime函数代码示例 |