your code worked and compiled fine for me (besides a typo in your post)
what exactly are you referring to as not working?
cout<<toupper(*pos)<<" "; //without cast it doesn't work, why? while it does work the output from it may not be what you are expecting. the output from toupper is int not char, so when it is cout'ed the result is going to the ascii equivalent for the character.
*pos=toupper(*pos); //and this also doesn't work
cout<<*pos<<" "; *pos is pointing to the character that the iterator is on (my wild guess) so it can be cast back to char without an explicit cast.
but it compiles and runs fine on my end :)
but if you are wondering my output from running this:
A 65 A
B 66 B
C 67 C
. .. .
Y 89 Y
Z 90 Z