SI 204 Spring 2017 / HWs


This is the archived website of SI 204 from the Spring 2017 semester. Feel free to browse around; you may also find more recent offerings at my teaching page.

Homework 26: Search

Name: _____________________________________________ Alpha: ___________________

Describe help received: ________________________________________________________

  • Due before class on Monday, March 27
  • This homework contains code to be submitted electronically. Put your code in a folder called hw26 and submit using the 204sub command.
  • This is an electronic homework and you do not need to print out anything to turn in during class.

Assignment

  1. Required reading: Sections 2.4 (Sorting any type) and all of section 3 (Search) from the Unit 7 notes,
  2. Write a program findname.c that reads in 5 names, then asks for a single letter, and prints out the first name that starts with that letter. If there is no name that starts with that letter, print "not found".

    Example runs:

    roche@ubuntu$ ./findname
    Enter 5 names: Judy Bill Deke John Suzy
    Letter: B
    Bill
    roche@ubuntu$ ./findname
    Enter 5 names: Judy Bill Deke John Suzy
    Letter: J
    Judy
    roche@ubuntu$ ./findname
    Enter 5 names: Judy Bill Deke John Suzy
    Letter: Q
    not found