>i just would like to know if there is nething I am doing wrong
If it doesn't work then it's a safe bet you're doing something wrong. :rolleyes:
>shown to me by a tutor so i figured he would know best
Most of the tutors that I've seen don't know squat. But the test chain works; I was just showing you an alternative method.
>Don't I have to find the first letter?
name[0]
is the first letter.
>one of the output samples lists the name Attila the Hun
Attila is the name of the person, the Hun is just a qualifier used to specify which Attila. However, you do have a distinct problem if this is one of the input strings. Using cin>>
string causes the read to stop at whitespace, so you would only have "Attila" in name rather than "Attila the Hun". Further iterations of the loop would read "the" and "Hun", in that order. If you need to read lines instead of words, you want to use getline:
while ( cout<<"Name? ", getline ( cin, name ) ) {
By the way, wasn't Attila the Hun a "bad" person? If so, then the example works properly.