#include#include "FloatArray.h" int main() { FloatArray myArray(10); //create an array with 10 elements //initialize the array with some values for (int i=0; i<10; i++) { myArray[i] = i*2.5; } //print the values in the array for (int i=0; i<10; i++) { std::cout << "myArray[" << i << "] = " << myArray[i] << std::endl; } return 0; }
#includeIn this example, we create a regular C++ float array called `data` with some initial values, and then use that to create a new FloatArray object called `myArray` with 5 elements. We then print the values in the array to the console. The package library for FloatArray is not specified in the examples, but it is likely a custom class defined in a local project.#include "FloatArray.h" int main() { float data[] = {1.1, 2.2, 3.3, 4.4, 5.5}; FloatArray myArray(data, 5); //create an array from a float array //print the values in the array for (int i=0; i<5; i++) { std::cout << "myArray[" << i << "] = " << myArray[i] << std::endl; } return 0; }