Professional Documents
Culture Documents
daily reminders. The user will enter a series of reminders, with each prefixed by a day of the
month. When the user enters 0 instead of a valid day, the program will print a list of all
reminders entered, sorted by day. Here’s what a session with the program will look like:
Day Reminder
5 Saturday class
5 6:00 – Dinner with Merge and Russ
7 10:30 – Dental appointment
12 Saturday class
12 Movie – “Dazad and Confused”
24 Susan’s birthday
26 Movie – “Chinatown”
The program should read a series of day-and-reminder combinations as a string, storing them in
order (sorted by day), and then display them. Store the strings in a two-dimensional array of
characters, with each row of the array containing one string. After the program read a day and its
associated reminder, it will search the array to determine where the day belongs, using strcmp to
do comparison. It will then use strcpy to move all strings below that point down one position.
Finally, the program will copy the day into the array and call strcat to append the reminder to
day. (The day and the reminder have been kept separate up to this point.)
In the program output, the days should be right-justified in a two-character field, so that
their ones digits will line up. Also, make sure that the user doesn’t enter more than two
digits.
where url points to a string containing a URL (Uniform Resource Locator) that ends with a
file name (such as “http://www.lakeheadu.com/index.html”). The function should modify
the string by removing the file name and the preceding slash. (In this example, the result
will be “ http://www.lakeheadu.com”.) Hint: Have the function replace the last slash in the
string by a null character.
Q4: Write a program that finds the “smallest” and “largest” in a series of words. After the
user enters the words, the program will determine which words would come first and last if
the words were listed in dictionary order. The program must stop accepting input when the
user enters a four-letter word. Assume that no word is more than 20 letters long. An
interactive session with the program might look like this:
Enter word: dog
Enter word: zebra
Enter word: rabbit
Enter word: catfish
Enter word: walrus
Enter word: cat
Enter word: fish
Q5: Write a program that accepts a date from the user in the form mm/dd/yyyy and then
displays it in the form month dd, yyyy, For example:
Enter a date (mm/dd/yyyy) : 2/17/2011
You entered the date February 17, 2011
Store the month names in an array that contains pointers to strings.