assign3

assign3 - COP 3502 Summer 2002 Assignment #3 Due in class:...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
Due in class: Wednesday July 10 th Problem #1 Assumptions: 1. Prompt the user to enter the value of n , assume that the maximum value of n is 20 for this program. Your program must check to be sure the user has entered a proper value for n . 2. User can enter both positive and negative values into the array. Example execution: Enter the number of elements in your array (1-20): 7 Enter number 1: -45 Enter number 2: -29 Enter number 3: 56 Enter number 4: -45 Enter number 5: -45 Enter number 6: 0 Enter number 7: 56 Number 56 appeared 2 times Number 0 appeared 1 time Number –29 appeared 1 time Number –45 appeared 3 times Problem #2 Assignment #3 - 1 Write a C program that reads n integers into an array, then prints on a separate line the value of each distinct element in the array along with the number of times it occurs in the array. The values must be printed in descending order. Your program must use different functions for the following tasks: 1. A function to read in the n integers and place them in the array. 2. A function which determines the distinct values and the number of times each occurs in the array. 3. A function which prints the distinct values and the number of occurrences for each in descending order. COP 3502 – Summer 2002 – Assignment #3 Write a C program that will read in a string of n characters (1 character at a time) then use a recursive function to reverse the string of characters and place them in to a second array in the reverse order from the original input order, and finally use another function to determine if the original string was a palindrome (a word or string that reads the same forward and backward). Your program should prompt the user for the original string, print out this string as well as the reverse of the string, and finally should print a message indicating if the string is a palindrome. You will write programs in C to solve the following problems. Each program is a stand- alone program, so the disk you submit will contain three separate programs.
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Assumptions: 1. Prompt the user to enter the value of n , assume that the maximum value of n is 20 for this program. Your program must check to be sure the user has entered a proper value for
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 8

assign3 - COP 3502 Summer 2002 Assignment #3 Due in class:...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online