搜尋此網誌

2025年7月29日星期二

for loops

In C++, vector<int> is a dynamic array from the Standard Template Library (STL) that stores integers. Unlike regular arrays, vectors can grow or shrink in size during runtime.

for (initialization; condition; update) {
    // Code to execute in each iteration
}

average += laptimes[i];
is equivalent to
average = average + laptimes[i];

average/= laptimes.size();
is equivalent to
average = average / laptimes.size();

Microsoft Copilot

沒有留言:

發佈留言