Find Jobs
Hire Freelancers

Array Duplicate Numbers

$30-5000 USD

Closed
Posted over 21 years ago

$30-5000 USD

Paid on delivery
Title: Eliminating duplicates Objectives: To introduce the concept of passing arrays to functions as parameters; create modular programs to process arrays. Description: Part 1. Write a C function that deletes all occurrences of an element from an array starting from a given index. The prototype of the function is as follows: //Preconditions: The first parameter is an integer array; the second parameter is an integer representing the number of elements in the array; the third parameter is the number that is to be deleted from the array; and the fourth parameter is the index from which the search for deletion should start. //Postconditions: The function deletes all elements whose value is equal to item starting from the index loc. The size of the array will decrease if one or more copies of item existed in the array. Therefore function changes the number of elements in the array as well. The function also returns the number of deleted items. int delete_elemet(int a[], int *n, int item, int loc); Part 2. Write a program that reads a sequence of unknown number of integers into an array. There may be a maximum of 20 integers in the input, so you should define the size of the array to be 20. Your program should then remove duplicates of all numbers in the array using the function that you wrote in part 1. After deleting the duplicates, your program should also print how many copies are deleted for each number having duplicates. Restrictions You must write the function delete_element() as described in part 1 and you must call it in your main function appropriately to perform the task described in part 2. Your main function should call the function delete_element() properly so that it can use the value that the function returns to print the number of copies deleted from the array. This printing must be done in the main function, not in the function delete_element() . Output Specification: Sample Run 1: Enter some integers (maximum of 20): 10 25 38 25 40 10 10 50 38 25 10 Value 10 : 3 copies are deleted. Value 25 : 2 copies are deleted. Value 38 : 1 copy is deleted. The resulting array is: 10 25 38 40 50 Sample Run 2: Enter some integers (maximum of 20): 21 21 21 21 21 21 21 Value 21: 6 copies are deleted. The resulting array is: 21 ## Deliverables 1) Complete and fully-functional working C program in executable form as well as complete source code of all work done. ## Platform Windows
Project ID: 2877578

About the project

5 proposals
Remote project
Active 21 yrs ago

Looking to make some money?

Benefits of bidding on Freelancer

Set your budget and timeframe
Get paid for your work
Outline your proposal
It's free to sign up and bid on jobs
5 freelancers are bidding on average $13 USD for this job
User Avatar
See private message.
$8.50 USD in 14 days
5.0 (1 review)
0.5
0.5
User Avatar
See private message.
$8.50 USD in 14 days
0.0 (0 reviews)
0.0
0.0
User Avatar
See private message.
$25 USD in 14 days
0.0 (0 reviews)
0.0
0.0
User Avatar
See private message.
$17 USD in 14 days
0.0 (0 reviews)
0.0
0.0
User Avatar
See private message.
$6.72 USD in 14 days
0.0 (0 reviews)
0.0
0.0

About the client

Flag of UNITED STATES
United States
5.0
3
Member since Oct 19, 2002

Client Verification

Thanks! We’ve emailed you a link to claim your free credit.
Something went wrong while sending your email. Please try again.
Registered Users Total Jobs Posted
Freelancer ® is a registered Trademark of Freelancer Technology Pty Limited (ACN 142 189 759)
Copyright © 2024 Freelancer Technology Pty Limited (ACN 142 189 759)
Loading preview
Permission granted for Geolocation.
Your login session has expired and you have been logged out. Please log in again.