Em Andamento

Array and Pointers

My redid is 817218071.

The sub-functions you write will have the following prototypes and perform the operations described:

int sum(int array[], int asize); /* returns the sum of the elements of a one dimensional array.*/

int swap( int *pA, int *pB ); /* returns a 1 if the integer stored at *pA is greater then the integer stored at *pB and swaps the two integers. returns 0 otherwise.*/

int sort_1pass(int array[], int asize ; /* makes one pass through the array, swapping pairs of values that are not in ascending order, using the swap() function above. Returns a 1 if any values were swapped and returns 0 otherwise.*/

void sort(int array[], asize); /* sorts the values in array in ascending order using sort_1pass() */

void printarray(int array[], asize); /* prints the contents of the array on one line*/

Use a preprocessor #define directive before main() to set the array size to 9 elements.

.

The main() function should perform the following actions, and call the sub-functions above where appropriate:

Declare and initialize the int array[] so that each array element contains one digit of your Red ID number, so if your Red ID was 876543210, the value of the first few elements in the array would be array[0]=8, array[1]=7, array[2]=6, and so on. The array declaration and initialization should look like this:

int array[] = {8,7,6,...};

Next main() should print all 9 array values in the array on a single line prior to processing.

Print the sum of the the digits in the array using the sum() function above.

Call function sort(), which then calls sort_1pass(), which calls swap() to swap individual pairs.

Print the 9 values in the array on one line after each sort_1pass() through the array.

The last line printed should be the 9 digits of your Red ID, sorted in ascending order.

Print the median (middle) digit in the sorted array.

Print the average of the digits in the array, accurate to 2 decimal places.

Habilidades: Programação C

Ver mais: sort array, set pairs, pointers programming, int size, integers and, elements actions, sort function, programming pointers, programming array, array programming, pa id, swap sort, sort contents, preprocessor, set value array, median, integer digit, declare int number, declaration number, print digits integer order, prototypes functions write, array digits

Acerca do Empregador:
( 3 comentários ) San Diego, United States

ID do Projeto: #6779269

Premiar a:

urmate

** Solution in 1 hour ** HI Contact me for an efficient, perfect, well documented development of your project according to 100% accuracy and requirements, with dedicated support. Thanks Farah Saif

$12 USD em 1 dia
(30 Avaliações)
4.2

16 freelancers estão ofertando em média $21 para este trabalho

vano101

Hello. I am C and C++ expert, it looks as pretty easy assignment for me, can be done in few hours ........

$15 USD em 1 dia
(418 Comentários)
6.5
it2051229

Hi, I am placing my bid on your project because I have read the requirements and I am confident enough with my C++ and algorithm skills. I am focused mostly on doing computer science work here in freelancer.com and I w Mais

$30 USD em 1 dia
(103 Comentários)
5.5
nauman187

hi I can start now and finish in a few hours please reply .

$13 USD em 1 dia
(20 Comentários)
4.2
oobretenov

may send me more info about the task. . . . .

$40 USD in 3 dias
(10 Comentários)
4.2
macfij7

Hi, I can solve your problem. I would start working on it ASAP. I know this stuff already. Cheers, Maciek :)

$20 USD em 1 dia
(1 Comentário)
1.8
jangkoo

A proposal has not yet been provided

$25 USD em 1 dia
(3 Comentários)
1.7
fazeelraza

Hello, sir. I am willing to make this program quickly for you within budget. PM me for discussion and get your work done in no time. thank you!

$22 USD in 0 dias
(0 Comentários)
0.0
shahidost

I am very confident about your project. I have two years experience in C\C++ and I can easily done this. You can trust me and I will provide your project with in time in complete form with accuracy. You consider it do Mais

$15 USD em 1 dia
(0 Comentários)
0.0
umarmughal824

A proposal has not yet been provided

$30 USD in 2 dias
(0 Comentários)
0.0
gutimac

Hello, I have a long experience in algorithm and performance. I have been working in auto-parallelization of algorithms in C for 2 years. I will do the project parallelized in OpenMP(Threads) or MPI(cores) (de Mais

$13 USD in 2 dias
(0 Comentários)
0.0
kasijus

A proposal has not yet been provided

$20 USD em 1 dia
(0 Comentários)
0.0
stenedjo

A proposal has not yet been provided

$25 USD em 1 dia
(0 Comentários)
0.0
UmerTahir1

I can do it, I know the way around arrays and pointers. I would just need a little time to do this.

$16 USD in 2 dias
(0 Comentários)
0.0
libuz94

I can finish the work within 2 days. Most likely earlier. If you have any questions, feel free to send me a message! //Linus

$12 USD in 2 dias
(0 Comentários)
0.0
c4551u5

A proposal has not yet been provided

$30 USD em 1 dia
(0 Comentários)
0.0