顺序表元素删除

删除顺序表中所有制定元素


```cpp
bool Delete(s& a1, int n, int e)
{
 if (n == 0)
  return false;
 else
 {
  int k = 0;
  for (int i = 0; i < n; i++)
  {
   if (a1.a[i]!= e)
   {
    a1.a[k] = a1.a[i];
     k++;
   }
  }
  a1.length = k;
  return true;
 }
}




猜你喜欢

转载自blog.csdn.net/weixin_46402983/article/details/107736423
今日推荐