I am trying to write a program to allow a user to enter the order (size) of a group of objects, then name them.
I have tried using an array but this requires a fixed size.
I have also tried setting up new variables each time in a loop, but I cannot find a way to find a new name for the variables each time the loop goes round.
I have also tried what is suggested on this page but the program didn't compile because it didn't like my declaration:
Code:
#include <iostream>
using namespace std;
int main()
{
int order;
cout <<"CREATE GROUP\nEnter order of G: ";
cin>>order;
cin.ignore();
cout<<"order of group is "<<order<<"\nEnter name of identity element (e.g. e, 1 or 0): ";
class *names;//HERE
names=new class [<<order<<];
cin>>*names[0];
cin.ignore();
The computer complains where I marked, 'invalid type in declaration before ';' token'
Any suggestions?