I need to create a program that allows a user to create up to 10 class objects (rationals), so a for loop seems logical... BUT I need to give each rational a name so I can call the constructor. Can I use an array here in the loop like this: rational name[i] (x, y)?
And if so, do I make the array a char array, or do I need to declare an array of class objects, and then construct each element with the parameters input by the user?
The next problem is that the objects each need to be stored and accessible to the user to perform member functions. Can I call a member function using an array for the calling object and for the argument (eg. name[i].add (rational name[i+2]) - where the function is rational rational::add(rational b))???
I'm completely stumped and feeling really foolish...
Any advice much appreciated!