Docsity

ELEC 2220 Homework Assignment 2: Sorting ASCII Character Data, Assignments of Electrical and Electronics Engineering

Toggle sidebar
bg1
ELEC 2220 - Homework Assignment #2
Prerequisite Review
Due Friday, August 22
The first assignment was a program to manipulate numeric data. This assignment is a
program to manipulate non-numeric (ASCII) character data.
Write a short program (in any language) that will read five names from the keyboard, and
then print the names in alphabetical order.
Run your program twice, with the names entered exactly as listed below, and in the given
order. One has all of the names capitalized, and the second has a mixture of upper and
lower-case letters. Turn in a printout of your program and the two sorted lists printed by
the program for the two runs.
In addition, discuss:
(1) whether the program produced what you expected for Example 2, and
(2) how you would modify the program to handle any number of names.
Example 1: Enter Sorted
Susan Bob
Ralph George
Marie Marie
Bob Ralph
George Susan
Example 2: Enter Sorted
Susan ?
RALPH
marie
bob
GeorGe

Partial preview of the text

Download ELEC 2220 Homework Assignment 2: Sorting ASCII Character Data and more Assignments Electrical and Electronics Engineering in PDF only on Docsity!

ELEC 2220 - Homework Assignment

Prerequisite Review

Due Friday, August 22

The first assignment was a program to manipulate numeric data. This assignment is a program to manipulate non-numeric (ASCII) character data.

Write a short program (in any language) that will read five names from the keyboard, and then print the names in alphabetical order.

Run your program twice, with the names entered exactly as listed below, and in the given order. One has all of the names capitalized, and the second has a mixture of upper and lower-case letters. Turn in a printout of your program and the two sorted lists printed by the program for the two runs.

In addition, discuss: (1) whether the program produced what you expected for Example 2, and (2) how you would modify the program to handle any number of names.

Example 1: Enter Sorted Susan Bob Ralph George Marie Marie Bob Ralph George Susan

Example 2: Enter Sorted Susan? RALPH marie bob GeorGe