how to declare class with 1000000 elements c++
问题 I am writing a c++ code and my need is to declare a class having two elments as class arr{ public: long num; string str; }; now i need to store almost 1000000 elments of this class(depending on user input number of class object can warry in a range of 1 <= n <= 1000000 The object are created dynamically as #include <iostream> #include<string> using namespace std; class arr{ public: long i; string str; }; int main(){ long n,j,i; cin>>n; arr a[n]; .... rest of programme but if value of n is