C++ STL 中的 multiset size(),带示例
在本文档中,我们将讨论一个程序,以了解 C++ STL 中的 multiset size()。
size() 函数返回给定容器中最存在的元素数。
示例
#include <bits/stdc++.h>
using namespace std;
int main(){
multiset<int> s;
s.insert(10);
s.insert(13);
cout << "The size of multiset: " << s.size();
s.insert(13);
s.insert(25);
cout << "\nThe size of multiset: " << s.size();
s.insert(24);
cout << "\nThe size of multiset: " << s.size();
return 0;
}输出
The size of multiset: 2 The size of multiset: 4 The size of multiset: 5
广告
数据结构
网络
关系型数据库管理系统
操作系统
Java
iOS
HTML
CSS
Android
Python
C 语言
C++
C#
MongoDB
MySQL
JavaScript
PHP