QP9 - lexicographically int my_strcmp(const char s1 const char s2 Pre-condition s1 and s2 are null terminated strings Post-condition copies the

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
Quiz Program #9 Program Description: Fun with Strings You are given the scaffold of a program that reads in names from a file and sorts those names in alphabetical order (according to the strcmp function). Your part of the assignment will be to write your OWN strcmp function and strcpy function with the following function prototype and pre and post conditions: // Pre-condition: s1 and s2 are null terminated strings. // Post-condition: -1 is returned if s1 comes before s2, // lexicographically, // 0 is returned if they are equal, // and 1 is returned if s1 comes after s2,
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: // lexicographically. int my_strcmp(const char* s1, const char* s2); // Pre-condition: s1 and s2 are null terminated strings. // Post-condition: copies the contents of s2 into s1 // and terminates the contents with a null // character. int my_strcpy(char* s1, const char* s2); The scaffold code is attached off a separate link for this quiz program. If you run it without changing my_strcmp and my_strcpy, the program will simply print out the list of names in the original order in which they were in the input file....
View Full Document

This note was uploaded on 06/09/2011 for the course COP 3223 taught by Professor Guha during the Spring '08 term at University of Central Florida.

Ask a homework question - tutors are online