The code below enters the number of arrays and the number of queries based on the arrays. The query consists of the array number and the desired element from that particular array.
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
using namespace std;
struct array
{
int arr[100000];
int n;
};
int main()
{
int i, j, b, d, e, f;
struct array a[100000];
cout << "Enter the number of arrays and the number of queries:";
cin >> b;
cin >> e;
cout << "Enter the value array size and enter the array elements:";
for(j = 0; j < b; j++)
{
cin >> a[j].n;
int c = a[j].n;
for(i = 0; i < c; i++)
{
cin>>a[j].arr[i];
}
}
for(i=0;i<e;i++)
{
cout << "Enter the query that consists of array number and the index of the desired element:";
cin >> d;
cin >> f;
cout << a[d].arr[f] << "\n";
}
return 0;
}