Hello,
i am just starting to learn c++. Ane hints or tips would be appreciated.
I have a text file that looks something like this
2 fred hind
6 julie frie
Now, i need to take that number, set it to an element of the array,
then store the name in that element.
I dont know hot to pull this off. so far, I have something like this.
------------------
char arr[20];
int num;
string first, last;
fstream inData;
inData open("textfile");
for (int x= 0; x < 20; x++){
inData >> num >> first >> last;
arr[num]= first+last;
}
-------------------------
of course this doesnt work since i cant do this, lol.
However, this is as far as i have gone with the logic.
I can however get the variable num to recieve the integer and have that set the element of the array.
I do not completely understand how i would do the rest.
Any tips would help out a lot/
Thank you.