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
Art [367]
3 years ago
12

Write a method called all Less that accepts two arrays of integers and returns true if each element in the first array is less t

han the element at the same index in the second array. For example, if the two arrays passed are {45, 20, 300} and {50, 41, 600}, your method should return true. If the arrays are not the same length, you should return false.Test your method and print out to the screen in main() function the following callsa. all Less(arr1, arr2); (where arr1 = [1,2,3,4,5], arr2 = [4,5,6,7,8])b. all Less(arr1, arr2); (where arr1 = [1,2,3,4,5], arr2 = [5,6,7,8])c. all Less(arr1, arr2); (where arr1 = [5,2,3,4,1], arr2 = [4,5,6,7,8])d. all Less(arr1, arr2); (where arr1 = [5,5,3,4,5], arr2 = [9,9,9,9,1])
Computers and Technology
1 answer:
GaryK [48]3 years ago
8 0

Answer:

The program to this question can be given as:

Program:

#include<iostream> //header file

using namespace std; //using name space

bool allLess (int arr1[], int arr2[]) //defining method allLess  

{

int a,b; //define variable

a=  *(&arr1 + 1) - arr1; //hold length of arr1

b=  *(&arr2 + 1) - arr2; //hold length of arr2

if(a!=b) //checking condition  

{

return 1; //return value

}

for(int i=0; i<a; i++) //loop

{

if( arr1[i]>=arr2[i]) //checking condition

{

return 1; //return value

}

}

return 0; //return value

}

int main() //define main method.

{

   int arr1[]={1,2,3,4,5}; //define array arr1 and assign value.

   int arr2[]={4,5,6,7,8}; //define array arr2 and assign value.

   cout<< allLess(arr1,arr2); //function calling

   return 0;

}

Output:

1

Explanation:

The Explanation of the C++ language program can be given as follows:

  • In the above program firstly we include the header file. Then a method is defined that is "allLess" this method accepts two arrays that are "arr1 and arr2". This function returns a boolean value that is true or false.
  • Inside a function, we define a conditional statement and a loop in the if block we check the length of the arr1 array variable is not equal to arr2 array length. if this condition is true it will return false.
  • In the loop, we define another if block in this block we check that if arr1 array elements are grater then equal to arr2 array element if this condition is true it will return false. At the end of both if block and loop the function will return a value that is "true".
  • In the main method, we define two arrays and pass to the function and use (cout function) for print return value.
You might be interested in
What are paragraphs separated by
Lemur [1.5K]

Paragraphs are usually separated by blank space.

Hope this is what you were looking for :)

6 0
2 years ago
Impacto que ha tenido en la sociedad la educacion virtual​
iVinArrow [24]

Answer:

ʜᴏʟᴀ ɪᴅɪᴏᴛᴀ

ᴄᴏᴍᴏ ᴇsᴛᴀs

ᴇsᴛᴜᴘɪᴅᴏ

7 0
2 years ago
The members of the IT department have spent two days debating the best approach to roll out the new software update. After allow
devlian [24]

Answer:

<em>Functional conflict</em>

Explanation:

Functional conflict means<em> encouraging workers to communicate different points of view and address disagreements in a healthy manner that can promote new ideas and new innovations.</em>

This compares with the unstable type of conflict that has no business advantage and only hurts the morale of interaction, productivity and workplace.

4 0
3 years ago
Question 3
prohojiy [21]

The Answer Should Be:

<u>The first thing for you to do when you arrive at an intersection is to stop at the traffic light. Your going to want to listen to the instructions or signals of the traffic Police.</u>

I Hope This Helps? :)

8 0
2 years ago
In order for an IT security framework to meet information assurance needs, the framework needs to include policies for several a
Ugo [173]

Answer:

(1) Protecting the privacy of personal data and proprietary information

(2) Proprietary Information

These two cannot be infringed on but below are the policies that must be taken in high esteem and can be infringed upon

(1) Disaster Recovery Policy

(2) Acceptable Use Policy

(3) Business Continuity plan

4 0
3 years ago
Other questions:
  • Describe a situation where it would be advantageous to use the copper tape or aluminum foil instead of the A and B push buttons
    7·2 answers
  • Which is a function of network media?
    11·2 answers
  • What statement best describes Konrad Zuse?
    6·2 answers
  • PLZ HELP ME! What is a false statement about online time?
    9·1 answer
  • _________ is a protocol used by e-mail clients to download e-mails to your computer. (
    6·1 answer
  • . Let F(X, Y, Z)=(X + Y + Z)(X + Y + Z)(X + Y + Z)(X + Y + Z). Use a 3-variable K-Map to find the minimized SOP form of this fun
    15·1 answer
  • Help meee pleaseeee
    5·1 answer
  • Word templates include pre-made flyers which may be edited and saved only if permission is obtained from the Microsoft Office te
    11·1 answer
  • Mô tả những lợi ích của việc sử dụng đa xử lý không đồng nhất trong một hệ thống di động
    8·1 answer
  • even if we reach that state where an AI can behave as human does,how do we measure if AI is acting like a human?
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!