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
Use System.DateTime along with System.Console to implement a simple C# program that does the following:_______.
Andre45 [30]

Answer:

5

Explanation:

I did it to and it was right

3 0
2 years ago
Which is true regarding pseudocode?
bearhunter [10]

Answer:

It uses simple words and symbols to communicate the design of a program

Explanation:

A software can be defined as a set of executable instructions (codes) or collection of data that is used typically to instruct a computer on how to perform a specific task and solve a particular problem.

A software development life cycle (SDLC) can be defined as a strategic process or methodology that defines the key steps or stages for creating and implementing high quality software applications. There are seven (7) main stages in the creation of a software and these are;

1. Planning.

2. Analysis.

3. Design.

4. Development (coding).

5. Testing.

6. Implementation and execution.

7. Maintenance.

A pseudocode refers to the description of the steps contained in an algorithm using a plain or natural language. Also, a pseudocode gives a summary of the steps adopted during a software development process using simple (concise) words and symbols.

This ultimately implies that, a pseudocode uses simple words and symbols to communicate the design of a program.

8 0
2 years ago
Read 2 more answers
Anyone wanna hop on 1v1.lol<br> party code : usfhb6
hjlf

Answer:

thx for the points

Explanation:

8 0
2 years ago
Read 2 more answers
What is an occupation?​
LiRa [457]

Answer:

a job or profession.

4 0
3 years ago
What are 2 of system software and how are they used?
xeze [42]

Answer:

System software is software on a computer that is designed to control and work with computer hardware. The two main types of system software are the operating system(Windows,Linux,Mac OS)  and the software installed with the operating system, often called utility software (Anti virus, Disk formatting, Computer language translators) . In some cases, the operating system and utility software depend on each other to function properly.

Some system software is used directly by users and other system software works in the background. System software can allow users to interact directly with hardware functionality, like the Device Manager and many of the utilities found in the Control Panel.

5 0
3 years ago
Other questions:
  • What is a benefit of peer-to-peer networking?
    14·2 answers
  • How could the provisions in the new health reform bill improve access to care?
    14·1 answer
  • An effectively distributed resume will get an interview
    12·2 answers
  • When you are working in Performance Monitor, in the "Add Counters" dialog box, and need more information about a particular coun
    8·1 answer
  • An EULA usually takes the form of an electronic notification that appears when installing software. The user then has a choice t
    14·1 answer
  • Will mark Brainliest!! What is the best hard disk compacity? Why?
    7·1 answer
  • WILL GIVE BRAINLIEST! The command simplify is used if you only want the first two digits of a decimal to appear in the interpret
    13·1 answer
  • Davingould1115...................answer 2​
    11·2 answers
  • Advantages of using Unicode to represent data
    8·1 answer
  • What is the decimal number 86 when written as a
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!