college

posted by .

Write a C++ program to fill an array with 6 numbers, and then reverse the values of this array.
Note: By using a function with two parameters with the name of the array and the size of this array.

  • college -

    If you need to interchange the values contained in two array element, you need to have a temporary storage.

    Assuming the array contains integers ("numbrs"), it would look something like this:

    int ar[6];
    .... read in values to ar[0] - ar[5].
    ...
    exchange(ar,6);
    ...

    void exchange{int ar[], int nar){
    int tmp,i;
    for(i=0;i<(nar+1)/2;i++){
    // exchange values of ar[i] and ar[nar-i-1]
    }
    }

Respond to this Question

First Name
School Subject
Your Answer

Similar Questions

  1. programming

    I really need help in this it makes me confuse.I should make a program to find a pattern...so can somebody help me... Write a function to recognize an pattern within another array. Your function should have the following prototype. …
  2. JavaScript

    I need help these javascript exericses: Input: A text string, using prompt. Output: Either "Valid name" or "Invalid name", depending on whether the input names fit the required format, which is Last name,first name, middle initial …
  3. Javascript

    I need help these javascript exericses: Input: A text string, using prompt. Output: Either "Valid name" or "Invalid name", depending on whether the input names fit the required format, which is Last name,first name, middle initial …
  4. computer science

    9.10: Reverse Array Write a function that accepts an int array and the array’s size as arguments. The function should create a copy of the array, except that the element values should be reversed in the copy. The function should …
  5. Math

    Don breaks a4 by 7array into a 2 by 7 array and another array. What is the fact for dons second array?
  6. math

    don break a 4x7 array into a 2x7 array and another array. what is the fact for dons second array?
  7. programming

    A. Write a program which reads an array of up to 200 integers from input and then does all the following in order 1. searches the array for a specific integer given by the user and outputs its position in the array; 2. outputs the …
  8. vembadi girls high school

    Write a java program to store n numbers an array and find the smallest number among them (using array )
  9. coding

    1.write a C program to reverse the elements of array using recursive function(without using for and while loop). 2. write a C program to check the occurrence of an element in array using recursive function(without using for and while …
  10. Math

    Tony broke a larger array into 2 x 9 array and a 4 x 9 array. What did the larger array look like?

More Similar Questions