traverse: cross
for (initialization; condition; update) {
// Code to execute repeatedly
}
average += laptimes[i];
average = average + laptimes[i];for (auto x : laptimes)
“For each element x in the container laptimes, do something with x.”auto: Automatically deduces the type of x (e.g., double if laptimes is a vector)
x: A copy of each element in laptimes
:: Reads as “in” — like “for each x in laptimes”
auto: Automatically deduces the type of x (e.g., double if laptimes is a vector)x: A copy of each element in laptimes:: Reads as “in” — like “for each x in laptimes”Microsoft Copilot
沒有留言:
發佈留言