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
kondaur [170]
3 years ago
11

Given an array of integers and the size of the array, write a function findDuplicate which prints the duplicate element from the

array. The array consists of all distinct integers except one which is repeated. Find and print the repeated number. If no duplicate is found, the function should print -1.
Computers and Technology
1 answer:
Jlenok [28]3 years ago
5 0

Answer:

#include <iostream>

using namespace std;

void findDuplicate(int arr[], int size) {

  for(int i = 0; i < size; ++i) {

      for(int j = i+1; j < size; ++j) {

          if(arr[j] == arr[i]) {

              cout << arr[j] << endl;

              return;

          }

      }

  }

  cout << -1 << endl;

}

int main() {

  int arr[] = {2, 3, 5, 6, 11, 20, 4, 8, 4, 9};

  findDuplicate(arr, 20);

  return 0;

}

Explanation:

You might be interested in
Which chart element provides the boundaries of the graphic?
Eddi Din [679]
The correct option is B.
Chart area is the boundary that contains all the chart and all its elements including the chart titles, legends, plot area, labels, etc.
The legend is the key that identifies the gradient, texture, colour and pattern fill given to each data series. 
The chart title is the label that describe the chart while the plot area is the section of the chart that contains graphical representation of the values in a data series.
7 0
3 years ago
Read 2 more answers
PLEASE CAN ANYBODY ANSWER ANY OF THESE
Pie

16 in Binary is ob10000

32 in Binary ob100000

I'm not sure if those are in 8 bit or not.


6 0
3 years ago
​You work for a company that is growing. Originally, all the users in all departments had access to all the data in the database
jeyben [28]

Answer:

B. Assign roles and privileges to users so that only job-relevant data is accessible to the user.

Explanation:

Certain departments will require certain information for certain processes. It is not recommendable for every user to access every information of the company as it may reveal vital information.

Hence, every role and department should be given certain privileges to information according to the tasks and needs of the role.

5 0
2 years ago
URGENT: I need to add a while loop in this program but I don't know-how. I am also having trouble neatening some lines of code.
dangina [55]

Answer:

Answer is in the provided screenshot.

Explanation:

You are making this more confusing for yourself by doing it like this.

I have added variables at the top of your program for game messages that are repeated - and also simplified the given cases for if the player wins, loses or ties.

I invite you to now make a point tracker that, at the start of each game says: You have "x" points.

And you gain a point for winning, lose a point for losing and nothing happens if you tie.

To add a while loop - simply use the "while" keyword, and anything within the loop will repeat while the given condition is true.

8 0
3 years ago
Substances become a form of “self-soothing” when one feels_______. a) stressed b) anxious c) the need for a reward d) all of the
Fynjy0 [20]
The answer vshould be stressed
3 0
3 years ago
Read 2 more answers
Other questions:
  • How will a packet tracer environment be affected if a heater is added to a container named branch office and turned on?
    5·1 answer
  • When a dynamic array with a class for a base type is declared, which constructor is called?
    5·1 answer
  • A computer's CPU and hard drive are found in the
    12·2 answers
  • Upon connecting to a Wi-Fi network, you're redirected to a login screen and a request to accept terms of service before being co
    15·1 answer
  • ___________ key encryption in wep uses the rc4 encryption algorithm.
    9·1 answer
  • Choose the parts of the browser window. PLEASE ANSWER QUICKLY TEST
    12·2 answers
  • Why do people enjoy codehs
    15·1 answer
  • Can someone please help me I need to turn this in my 3:00pm Eastern time
    12·1 answer
  • List any four e-commerce website​
    5·2 answers
  • Design a program that asks the User to enter a series of 5 numbers. The program should store the numbers in a list then display
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!