hmm ok am i doing it right
Code:
char buffer[33];
memset(buffer, ' ', 33);
it doesn't seem to be working this is the code i am having problems with
Code:
int magicmenuchanger(string line1, string line2, string line3)
{
int h=0;
int max=numspells+1;
int spellnum=1;
line1.append(addstring(line1, spell[h].name, spellnum));
cout<<line1<<endl;
h=h+3;
spellnum=spellnum+3;
line1.append(addstring(line1, spell[h].name, spellnum));
cout<<line1<<endl;
return 0;
}
string addstring(string x, string z, int number)
{
char buffer[33];
memset(buffer, ' ', 33);
itoa (number,buffer,16);
x.append(buffer);
x.append(". ");
x.append(z);
return x;
}
spell[0].name is bolt while spell[3].name is cure but when i tell it to cout line one it displays (edit) 1.bolt the first time which is corerct but then the second time it displays (/edit) 1. bolt1. bolt4. cure instead of just 1. bolt4. cure. I am not sure why.