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 term describes the amount you must pay in order to be considered “up-to-date” with your credit card payments?
yuradex [85]

Answer:

Minimum payment.

Explanation:

A loan can be defined as an amount of money that is being borrowed from a lender and it is expected to be paid back at an agreed date with interest.

Generally, the financial institution such as a bank lending out the sum of money usually requires that borrower provides a collateral which would be taken over in the event that the borrower defaults (fails) in the repayment of the loan.

A credit score can be defined as a numerical expression between 300 - 850 that represents an individual's financial history and credit worthiness. Therefore, a credit score determines the ability of a borrower to obtain a loan from a lender.

This ultimately implies that, the higher your credit score, the higher and better it is to obtain a loan from a potential lender. A credit score ranging from 670 to 739 is considered to be a good credit score while a credit score of 740 to 799 is better and a credit score of 800 to 850 is considered to be excellent.

Additionally, credit card can be defined as a small rectangular-shaped plastic card issued by a financial institution to its customers, which typically allows them to purchase goods and services on credit based on the agreement that the amount would be paid later with an agreed upon interest rate.

Minimum payment is a term which describes the amount you must pay in order to be considered “up-to-date” with your credit card payments. A credit card holder that meets the minimum payment and has a good credit score is eligible for more credits and loans.

4 0
2 years ago
Which group allows you to add notes to your presentation?Ella has finished drafting her presentation. What should she do next?
liq [111]
Ella should view the presentation as a slideshow to see how it will look to her audience. 
6 0
3 years ago
Read 2 more answers
What type of network is the Internet? The Internet is an example of a_____network.
7nadin3 [17]

The Internet is an example of a WAN: Wide Area Network

5 0
3 years ago
Nonprocedural access to a database
777dan777 [17]

Answer:

Option D: All of above.

is the correct answer.

Explanation:

  • Non-procedural access is the feature of the database.
  • This means that when a database is created in a database management system (DBMS) using data definition language (DDL), it will be accessed every time using a data manipulation language (DML). The standard DML is SQL. SQL stands for Sequential Query Language.
  • This feature of database ultimately improves the software productivity.
  • Most of the tools of Database Management systems (DBMSs) support the non-procedural access.
  • This feature permits a user to submit queries to a database without knowing how to retrieve data.

i hope it will help you!

4 0
3 years ago
Which of the following are true about the PUSH instruction?
kkurt [141]

Answer:

Option A.

Explanation:

Only option A satisfies the definition of push statements. So it is only the correct option.

7 0
3 years ago
Other questions:
  • What should not be compromised when trying to meet standards and deadlines?
    12·1 answer
  • Freya realizes she does not have enough in her bank account to use the debit card. She decides to use a credit card instead. Whi
    7·2 answers
  • Suppose two hosts, A and B, are separated by 15,000 kilometers and are connected by a direct link of R = 5 Mbps. Suppose the pro
    11·1 answer
  • Which practice represents the trait of effective communication?
    6·2 answers
  • Arman, a friend of your dad, has a computer running Windows 7 and wants to perform an upgrade. He has only 3GB of RAM in his com
    13·1 answer
  • Which of the following is NOT an argument used to determine how a shot is fired from an A. object the shot itself being instanti
    12·1 answer
  • Which of the following is a web app?
    5·1 answer
  • You upgrade a graphics workstation with a HyperThreading-enabled CPU core. You expect the programs on the desktop to run much fa
    12·1 answer
  • Explain why the process of sketching in engineering might resemble a loop or a cycle.
    15·2 answers
  • The software concept ___________and defines a need for the new system.
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!