Advising

As part of your lab for this week, all CPE, CSC, and SE majors are required to fill out a Spring Advising Form. As part of the requirements on this form, you will need to meet with your faculty adviser, so plan ahead.

Those that are not CPE, CSC, or SE majors need not submit the form, but are equally encouraged to meet with their respective adviser regarding Spring planning and registration.


This lab presents an exercise on strings and an exercise on files. You will develop one program that determines if one string appears within another. You will then develop a program that reads the contents of a file and prints the result after applying the rotate-13 translation from lab 6.

You can get support files by downloading lab7.zip.


Programs

Develop the following programs in the files specified for each part. To compile your program, in the respective directory, type make debug for the debug version and make run for the run version.

Test Cases

As always, you must develop test cases for the functions that you write. It is recommended that you develop these test cases before you write the code for each function. Place the test cases in the test_cases function. You are writing two separate programs. Each program must contain a test_cases function.

Program 1 -- substring

Develop a program in a file named substring.c that reads two strings and prints the number of times that the first string appears within the second string.

Program 2 -- rot-13 by file

Write a program in a file named rot_13.c that takes, as a command-line argument, a filename. Read this file and print, to the terminal, the rot-13 encoding of the contents of the file. You can review Lab 6 for details on rot-13 encoding.


Demonstration

Demonstrate your work to your instructor to have this lab recorded as completed.