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