Hello, OnlineGDB Q&A section lets you put your programming query to fellow community users. Asking a solution for whole assignment is strictly not allowed. You may ask for help where you are stuck. Try to add as much information as possible so that fellow users can know about your problem statement easily.

How do I print out the Misses in alphabetical order?

+1 vote
asked Jan 15 by TylerBlachowiak (330 points)

1 Answer

+1 vote
answered Jan 16 by Peter Minarik (19,180 points)

There could be various ways to do this.

  1. Before printing out, you sort your characters in a string alphabetically.
  2. You do not use a StringBuilder to store your characters, but a byte array instead. Every character is represented by a byte from 0 ('a') til 26 ('z'). You initialize the array to 0 (false). If the user tries one of the letters, you mark that one 1 (true). In the end, you iterate through the array and print only those letters that have their id marked as true. Tip: char ch; (ch - 'a') will give you their id.
Good luck
Welcome to OnlineGDB Q&A, where you can ask questions related to programming and OnlineGDB IDE and and receive answers from other members of the community.