C++教程
C++控制语句
C++函数
C++数组
C++指针
C++对象
C++继承
C++多态
C++抽象
C++常用
C++ STL教程
C++迭代器
C++程序

C++ List size()

C++ List size()函数查找列表中存在的元素数。此功能不会修改双端队列的内容。

语法:

int size();

参数:

它不包含任何参数。

返回值:

它返回列表中的元素数。
让我们看一个简单的例子
#include <iostream>  
#include<list>  
using namespace std;  
int main()  
{  
    list<int> li={1,2,3};  
    std::cout << "size of the list is: " << li.size()<<std::endl;  
    return 0;  
}  
输出:
size of the list is: 3
昵称: 邮箱:
Copyright © 2022 立地货 All Rights Reserved.
备案号:京ICP备14037608号-4