algorithm頭文件下的fill()

fill()能夠把數組或容器中的某一段區間賦予相同的值。ios 和memset不一樣,這裏能夠是數組類型對應範圍中的任意值。web 示例以下:數組 #include<iostream> #include<algorithm> #include<string> using namespace std; int main() { int a[5]={1,2,3,4,5}; fill(a+1,a+4
相關文章
相關標籤/搜索