How to output one particular field in a form

Pages: 12
Are you just capitalizing the first letter of the name?

I think I'd do that once as the name is entered and store it that way instead of doing a conversion every time the name is output.

The <cctype> header has a toupper function (as well as tolower, isupper, islower).
http://www.cplusplus.com/reference/cctype/

1
2
3
std::cin>>group[i].surname; //name entered
if (islower(group[i].surname[0])) //if the first character is lower case
    group[i].surname[0] = toupper(group[i].surname[0]);//use the toupper function 
Last edited on
Okay! I think your suggestion is perfect...
Thanks a bunch!
@wildbird:
Still on that program, how can make it to output:
1. List of users arranged in alphabetical order of Surnames.
2. List of all users in the same department who come from the same state, but arranged according to sex.
Assuming I included a "state" as a new member of d struct
Thanks!
Last edited on
If you're allowed to use the <algorithm> header, there's a sort function there. There's an example in the thread below.

http://www.cplusplus.com/reference/algorithm/sort/
http://www.cplusplus.com/forum/general/97555/
At the end of the day, I was able to list all users in alphabetical order by surname but was unable to sort users whose dept and state matched according to sex...
Thanks!
Topic archived. No new replies allowed.
Pages: 12