lopping over an array c++
#include <iostream>
int main() {
// Declare an array of integers
int numbers[] = {1, 2, 3, 4, 5};
// Determine the size of the array
int size = sizeof(numbers) / sizeof(numbers[0]);
// Loop over the array using a for loop
for (int i = 0; i < size; ++i) {
// Access each element of the array using the index
int currentNumber = numbers[i];
// Perform operations with the current element (print it in this case)
std::cout << "Element at index " << i << ": " << currentNumber << std::endl;
}
return 0;
}