日韩av黄I国产麻豆传媒I国产91av视频在线观看I日韩一区二区三区在线看I美女国产在线I麻豆视频国产在线观看I成人黄色短片

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 >

c++ array stl_C ++ STL中带有示例的array :: front()函数

發布時間:2025/3/11 49 豆豆
生活随笔 收集整理的這篇文章主要介紹了 c++ array stl_C ++ STL中带有示例的array :: front()函数 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

c++ array stl

C ++ STL array :: front()函數 (C++ STL array::front() function)

font() function is a library function of array and it is used to get the first element of an array, it returns the reference to the first element in an array.

font()函數是array的庫函數,用于獲取數組的第一個元素,它返回對數組中第一個元素的引用。

Syntax:

句法:

array_name.front();

Parameters: None

參數:無

Return value: It returns a reference to the first element of array_name.

返回值:返回對array_name的第一個元素的引用 。

Example:

例:

Input or array declaration:array<int,5> values {10, 20, 30, 40, 50};Function call:values.front();Output:10

C ++ STL程序使用array:front()獲取數組的第一個元素 (C++ STL program to get the first element of an array using array:front())

#include <array> #include <iostream> using namespace std;int main() {array<int,5> values {10, 20, 30, 40, 50};//printing first elementcout<<"First element is: "<<values.front()<<endl;return 0; }

Output

輸出量

First element is: 10

翻譯自: https://www.includehelp.com/stl/array-front-function-with-example-in-cpp-stl.aspx

c++ array stl

總結

以上是生活随笔為你收集整理的c++ array stl_C ++ STL中带有示例的array :: front()函数的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。