#include <iostream>
struct MyStruct {
int id;
double value;
};
int main() {
const int size = 3;
MyStruct array[size];
// Step 1: Initializing array of structs with size 3
// Step 2: Define a struct named MyStruct with two members: int id and double value
// Step 3: Assigning values to each element in the array
array[0].id = 1;
array[0].value = 2.5;
array[1].id = 2;
array[1].value = 3.7;
array[2].id = 3;
array[2].value = 1.2;
// Step 4: Accessing and printing values from the array of structs
for (int i = 0; i < size; ++i) {
std::cout << "Element " << i << ": ID = " << array[i].id << ", Value = " << array[i].value << std::endl;
}
return 0;
}