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
When a person visits a web site, his or her ip address and the links he or she clicked on are automatically recorded. this is an
allochka39001 [22]
B. Invisible information gathering.
8 0
3 years ago
_ includes websites that encourage interaction and connection among people, businesses, and organizations. A. News sites B. Sear
Dovator [93]
> News sites give information about news or what is trending around the area or world (CNN, Fox, MSNBC, etc) 

> Search engines is what allows you to look up websites (Google, Bing, Yahoo, etc) 

> Social media AKA Social Networking sites is interaction social sites where you connect with various people from around the world. (Facebook, Twitter, Google+, etc)

>Apps is short for applications which is an application that has a specific function (Games, Music, Social networking) 

So based on this, you answer is C. Social Media
6 0
3 years ago
Read 2 more answers
Now, my Laptop has been working since I bought it yesterday it won’t start up and it when it does it overheats and shuts off, th
tekilochka [14]

I would bring it back since it’s not working. No way would I spend hard earned money on something that doesn’t work.

Hope this helps.

7 0
3 years ago
Read 2 more answers
4. How many times will the print statement be executed within the following nested for loops? Briefly explain how or show the ma
HACTEHA [7]

Print statements are used to display outputs

The number of times the nested loop will be executed is 43200

<h3>What are nested for loops?</h3>

Nested for loops are loops that are placed within another loop or loops

From the statement, we have the following loop conditions:

h = 1; h <= 12, m = 0; m <= 59 and s = 0; s <= 59

The above means that:

  • h = 12 --- the outer loop will be executed 12 times
  • m = 60 --- the middle loop will be executed 60 times
  • s = 60 --- the inner loop will be executed 60 times

So, the number of times the nested loop will be executed is:

Count = 12*60 *60

Count = 43200

Hence, the number of times the nested loop will be executed is 43200

Read more about loops at:

brainly.com/question/14284157

8 0
2 years ago
Which question would you ask when proposing a private cloud?
Ludmilka [50]
I think the answer would be C :)
5 0
3 years ago
Read 2 more answers
Other questions:
  • Tracy has a file that contains a list of actors and the movies in which they acted. She wants to know the top 3 ranked actors fr
    10·1 answer
  • Why should spain go to Africa ​
    15·1 answer
  • Which of the following things would you access from the Program &amp; Courses page? Course descriptions Tutorial videos Account
    7·1 answer
  • _______ data would be useful for creating a report containing last year's revenue, which won't be changing.      A. Integrated B
    12·1 answer
  • 11. The golden rule of safe driving is: A. Always drive at the posted speed limit B. Never drive while physically or mentally im
    6·1 answer
  • What are the useful techniques in program design?
    12·1 answer
  • Lisa is modifying a spreadsheet. Which view will allow Lisa to see how her changes will look when she prints the spreadsheet?
    13·2 answers
  • Any recommendations for anime series on netflix?
    14·1 answer
  • What is the reason that friction is present in surface to surface contact?
    5·1 answer
  • What does not stand for​
    15·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!