OK, I have a assignment due to use dynamic arrays to make a program that requires user input.It has to be dynamic array, and we never went over vectors in school..as I've seen it used in other not so similar programs, and the result is tabular output like:
Canidates Votes Received % of Total Votes
Name 5000 25.91
Name 4000 20.73
Name 6000 31.09
.
.
That said, my trouble problem is the dynamic char array. Not sure why this is not working. (can be in int main(), no need for class..)
int size;
char* name = new char[25];
cout << "Enter num of names: ";
cin>>size;
for(int i=0;i<size;i++){
cout << "Enter your name: ";
cin>>name[i]; //cin.getline(name,25); tried this first...not it.
}
for(int i=0;i<size;i++){
cout<<name[i]<<endl;
}
Wanting size to set how many names will be entered. for() loop being how many times cin will get names. Second for() to cout the names. (Not formatted for tabular obviously) Just trying to figure out why this is not working. I have tried every forum/example I can find. Just can't find an "English" version I can understand. HELP please....(again it's homework and late already : ( Thank you.