1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
klemol [59]
2 years ago
9

9.10: Reverse ArrayWrite 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 return a pointer to the new array . Demonstrate the function by using it in a main program that reads an integer N (that is not more than 50) from standard input and then reads N integers from a file named data into an array . The program then passes the array to the your reverse array function, and prints the values of the new reversed array on standard output , one value per line. You may assume that the file data has at least N values .Prompts And Output Labels. There are no prompts for the integer and no labels for the reversed array that is printed out.Input Validation. If the integer read in from standard input exceeds 50 or is less than 0 the program terminates silently.The Language is C++
Computers and Technology
1 answer:
AleksandrR [38]2 years ago
8 0

Answer:

#include <iostream>

using namespace std;

int * reverse(int a[],int n)//function to reverse the array.

{

   int i;

   for(i=0;i<n/2;i++)

   {

       int temp=a[i];

       a[i]=a[n-i-1];

       a[n-i-1]=temp;

   }

   return a;//return pointer to the array.

}

int main() {

   int array[50],* arr,N;//declaring three variables.

   cin>>N;//taking input of size..

   if(N>50||N<0)//if size greater than 50 or less than 0 then terminating the program..

   return 0;

   for(int i=0;i<N;i++)

   {

       cin>>array[i];//prompting array elements..

   }

   arr=reverse(array,N);//function call.

   for(int i=0;i<N;i++)

   cout<<arr[i]<<endl;//printing reversed array..

   cout<<endl;

return 0;

}

Output:-

5

4 5 6 7 8

8

7

6

5

4

Explanation:

I have created a function reverse which reverses the array and returns pointer to an array.I have also considered edge cases where the function terminates if the value of the N(size) is greater than 50 or less than 0.

You might be interested in
Purpose: This application provides experience with user input and interaction in the Console, writing files to disk, working wit
pishuonlain [190]

Answer:

the answer is c#/.net

Explanation:

5 0
2 years ago
The part of the computer that provides access to the Internet is the
andrew11 [14]

Answer:

MODEM

Explanation:

5 0
2 years ago
¿Qué creo que debe considerar una empresa para elegir ellugar en el cual va a desarrollar su actividad económica osu emprendimie
zhannawk [14.2K]

Answer:

sorry I don't speak that language

8 0
2 years ago
Arturo is a security professional. He is strengthening the security of an information system. His design ensures that if a field
Cloud [144]

Arturo is attempting to protect the database (data) of an information system (IS).

<h3>What is an information system?</h3>

An information system (IS) can be defined as a set of computer systems, that is typically used to collect, store, and process data, as well as the dissemination of information, knowledge, and the distribution of digital products.

In Cybersecurity, there are two (2) main techniques that can be used to check data when inputted in an information system (IS) and these include:

  • Verification
  • Validation

Data validation is a type of check which is primarily performed by a software program (application) to make sure that the data which is entered into an information system (IS) is allowable and sensible.

This ultimately implies that, any data that is not allowed or sensible are rejected and discarded by the computer system.

In conclusion, we can deduce that Arturo is attempting to protect the database (data) of an information system (IS).

Read more on data here: brainly.com/question/25885448

3 0
2 years ago
0 Select the correct answer. Which is an advantage of programming with a procedural language? A. Procedural program code is easy
Novosadov [1.4K]

Answer:

D. Algorithms of simple problems are readily available for reference. ​

Explanation:

Hope this helps you! Ask me anything if you have any quistions!

7 0
2 years ago
Other questions:
  • Function prototypes and function definitions look similar because they have the same function heading. In a function prototype t
    14·1 answer
  • What do you call a named collection of data stored on a disk?
    15·1 answer
  • During an interview, your non-verbal communication (body language, gestures, tone of voice, speed of talking,
    6·1 answer
  • Text can be easily moved from one location to another using _____.
    15·1 answer
  • Two system administrators who work in two different buildings for the same company want to open a communication channel between
    8·1 answer
  • Top 5 best comedy or action movies.
    9·2 answers
  • Sharl downloads images from an online library and uses them in her work. The images are shared under the Creative Commons Attrib
    13·1 answer
  • Anyone have any website ideas I could use for my computing website project? Thank you.
    15·2 answers
  • Discuss the advantages and disadvantages of supporting links to files that cross mount points (that is, the file link refers to
    6·1 answer
  • question 5 you need to find the internet protocol (ip) address for a website. which command do you use on a windows system?
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!