{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

QP9 - lexicographically int my_strcmp(const char s1 const...

Info icon This 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,
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

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern