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
7nadin3 [17]
3 years ago
10

In this question, you must create a function in C++ using an external editor. When satisfied with your work, you shall attach it

here for full credit. All your source code must be in one cpp file. Write a function that accepts two parameters, the first shall be an array of integers, and the second shall be the length of the input array. The function you create shall process the input array and calculate if multiplying any two numbers within produces a result also contained in the array. If the product of two number equals a third contained in the array, the function shall return true (1). Otherwise, the function shall return 0. For example, array: [0,1,3,5,15], the function shall return True, for 3x5=15. array: [0,1,3,3,7], the function shall return True, for 1x3=3. (duplicates are possible) array: [2,-4,-3,10,8], the function shall return False array: [6,4,-3,-2,0,5], the function shall return True, for -3x-2=6 Do not assume well-formed input, so you must include some basic error checking. You may use the header files contained in the standard library and are encouraged to use data structures (like a map or set) to complete the problem efficiently
Computers and Technology
1 answer:
RideAnS [48]3 years ago
6 0

Answer:

See explaination

Explanation:

#include<iostream>

#include<map>

using namespace std;

bool contains(int arr[], int size){

map<int,int> nums;

for(int i=0; i< size; i++) nums[arr[i]]=1;

int product;

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

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

product = arr[i]*arr[j];

if (nums[product]==1) return true;

}

}

return false;

}

int main(){

int arr[] ={6,4,-3,-2,0,5};

cout<<boolalpha <<contains(arr,5)<<endl;

return 0;

}

You might be interested in
In addition to not parking where signs prohibit it, you should never park __________________.
Genrish500 [490]
In front of a fire hydrant
4 0
3 years ago
What color model should Joe use if he will be using an offset printing press?
EleoNora [17]

Answer:

CMYK

Explanation:

Monitors typically use RGB color (additive model — adding to make white), but offset printing uses CMYK pigments (subtractive color — subtracting from the existing white). Printed images have less visual range, saturation, and contrast than digital images, so in print, colors will usually appear darker and less vibrant.

6 0
3 years ago
UC is trying to switch from legacy CRM to salesforce and wants to keep legacy CRM and salesforce in place till all the functiona
nikklg [1K]

Answer: suggesting MDM solution and also linking MDM to both the salesforce and sap. More so, integrating SAP with both Salesforce and legacy CRM.

NB: Don't ever integrate legacy CRM to Salesforce

Explanation:

It should be noted that the best recommendation that could be given in order to keep data in synch b/w Salesforce, legacy CRM and SAP is by suggesting MDM solution and also linking MDM to both the salesforce and sap. More so, integrating SAP with both Salesforce and legacy CRM.

NB: Don't ever integrate legacy CRM to Salesforce

5 0
3 years ago
If you see these REPORT.
Alenkinab [10]

Answer:

ok will do

Explanation:

3 0
2 years ago
Read 2 more answers
What was ARPANET?
Anit [1.1K]

Answer:

The ARPANET was the first network that provided commercial internet services. And also it was the first network to make use of the TCP/IP protocols. However, you need to know that the first ISP or the internet service provider was the Telenet, and it was the first commercial version of the ARPANET which was introduced in the year 1974. And this service started its service for the customers in the year 1989.

Explanation:

Please check the answer section.

7 0
3 years ago
Other questions:
  • The two variables causing the point of difference between the time codes are the frequency and the count
    6·1 answer
  • A name given to a spot in memory is called:
    5·1 answer
  • A company wants a recruiting app that models candidates and interviews; displays the total number of interviews each candidate r
    6·1 answer
  • A signal has a spectrum from 0 to 145 Hz, as shown below. It is sampled at a rate of 295 Hz. Find the region of the baseband spe
    5·2 answers
  • Computer piracy occurs when what is violated
    6·1 answer
  • The engineering firm you work for is submitting a proposal to create an amphitheater at a state park. Proposals must be submitte
    15·1 answer
  • Assume the availability of a function is_prime. Assume a variable n has been associated with positive integer. Write the stateme
    15·1 answer
  • Suppose your name was George Gershwin. Write a complete main method that would print your last name, followed by a comma, follow
    9·1 answer
  • 1. What type of malware is triggered by a specific condition, such as a specific date or a particular user account being disable
    6·1 answer
  • Does nature behave the exact same way as fractals?
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!