Hwk - Outputting names in alphabetical order

  • (3 Pages)
  • +
  • 1
  • 2
  • 3

30 Replies - 1559 Views - Last Post: 17 November 2013 - 09:18 AM Rate Topic: -----

#31 DrSpoon69  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 17-November 13

Re: Hwk - Outputting names in alphabetical order

Posted 17 November 2013 - 09:18 AM

Is this the source?

Task 3: Name order (harder)
Strings of characters can be compared alphabetically using boolean operators in exactly the same way as numbers are compared. For example, the following pseudocode instructions would display the names in alphabetical order:

if Name1 < Name2
then output Name1, Name2
else output Name2, Name1
endif

Write a program that asks for three names and then uses nested IF statements to display them in alphabetical order.

Note 1: You will need to test your program very thoroughly. There are six different ways of arranging any three given names. Your testing should cover all six.
Note 2: You will get unexpected results if you do not use capital letters consistently. This is because of the way that characters are stored using character codes and is explained fully in Section 5.2.
Was This Post Helpful? 0
  • +
  • -

  • (3 Pages)
  • +
  • 1
  • 2
  • 3