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
In order for a fault-block mountain to form, a ______ must take place along a fault line and one side must be ________.
Sav [38]
I think the correct answer from the choices listed above is the first option. In order for a fault-block mountain to form, a shift must take place along a fault line and one side must be elevated. Fault-block mountains form<span> when Earth's crust pushes material up and down near a </span>fault line<span>. Hope this answers the question.</span>
7 0
3 years ago
Smart art can be used to create that highlight relationships between two items
Allisa [31]

Answer:

The answer to this question is given below in this explanation section.

Explanation:

A smart Art graphic is a visual representation of your information and ideas.you create one by choosing a layout this fits your message.Some layouts specific kind of information,while other simply enhance the appearance of a bulleted list.

    You can create a smart graphic in excel power point,word,or in an email message in outlook.The smart button is one the insert tab and developing on your screen size,may look like.

Other office program do not allow for smart art art graphic creation,but you can copy and paste smart graphics as image into those programs.As part of this process,when you are prompted to choose a type such as process hierarchy,or relationship.A type is similar to a category of smart art graphic,and each type contains several different layouts.

Because you can quickly and easily switch layouts,try different layouts until you find the one that best illustrate your message.

7 0
2 years ago
Help!! me!! plsssssssssssssssssssssssssssssssssss
Maslowich

Answer:

e,f,g, and h

Explanation:

5 0
2 years ago
What will be the topic of the essay?
bonufazy [111]
Are actors and athletes paid too much?
8 0
3 years ago
Effective nonverbal communication can cause tension.<br><br> True or False
agasfer [191]

Explanation:

When your nonverbal signals match up with the words you're saying, they increase trust, clarity, and rapport. When they don't, they can generate tension, mistrust, and confusion.

4 0
3 years ago
Other questions:
  • Henri is working in a complex financial spreadsheet that has hundreds of columns of data. If he is at column AN and would like t
    11·1 answer
  • What is the part of the computer system that receives inputs, directs those inputs to the processor, and redirects the processed
    14·1 answer
  • The programs that provide the infrastructure and hardware control necessary for the computer and its peripheral devices are call
    11·1 answer
  • If you wanted to create a graph that showed how much each value contributed to the whole value, you would use a _____.
    15·2 answers
  • Choose the best technology device for the
    12·1 answer
  • What is an instruction set architecture​
    7·2 answers
  • What specific authentication method has no encryption for user credentials or data, and is not recommended for most applications
    14·1 answer
  • Can anyone please help me to solve this question?
    10·1 answer
  • A file manager is used for all of the following except ____.
    12·1 answer
  • For a certain company, the cost function for producing x items is C(x)=50x+100 and the revenue function for selling x items is R
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!