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
topjm [15]
3 years ago
14

Write a function named firstLast2 that takes as input an array of integers and an integer that specifies how many entries are in

the array. The function should return true if the array starts or ends with the digit 2. Otherwise it should return false. Test your function with arrays of different length and with the digit 2 at the beginning of the array, end of the array, middle of the array, and missing from the array.
Computers and Technology
1 answer:
frosja888 [35]3 years ago
4 0

Answer:

<em>Written in C++</em>

#include<iostream>

using namespace std;

int firstLast2(int arr[], int n);

int main()

{

int n;

cout<<"Number of Elements: ";

cin>>n;  

int myarray[n];

for(int i = 0; i<n;i++) {

cin>>myarray[i];

}

firstLast2(myarray, n);

return 0;

}

int firstLast2(int arr[], int n){

if(arr[0] == 2 || arr[n - 1] == 2) {

 cout<<"True";

}

else {

cout<<"False";

}

}

Explanation:

<em>I've added the full source code as an attachment where I used comments to explain difficult lines</em>

Download cpp
You might be interested in
Which plan includes procedures and processes that ensure the smooth functioning of the business even after a disaster?
mamaluj [8]

Answer:

The plan that includes procedures and processes that ensure the smooth functioning of the business even after a disaster is the:

business continuity and disaster recovery plan.

Explanation:

An entity that has good business continuity and disaster recovery plan maintains its full operational activities and processes after a business disaster.   After the business disaster, the entity may even grow bigger, because it has identified critical functions and their dependencies for continued growth.  While the period is a time of recovery, for business entities that are well-prepared, the recovery period offers a unique opportunity for innovation and rapid recovery and development on all fours: organization, processes, people, and performance.

8 0
2 years ago
Read 2 more answers
A(n) ________ collects data from various key business processes and stores the data in a single comprehensive data repository, u
xxTIMURxx [149]

Answer:

An Enterprise System

Explanation:

An enterprise system also refered to as an enterprise software is a computer software application used to handle the needs of a business or an enterprise examples are schools, production companies, government ministries and departments, charities etc.

The software provides all the business oriented services for the enterprise, services such as payment processing, students' information management, automated billing and payments etc.

Because enterprises will typically have different departments, the software is able to collect data from all the key business processes across all the departments into a single database which is useable according to different access privilages by all other parts of the enterprise.

3 0
2 years ago
E-governance is the only solution against corruption. justify the statement in context of nepal​
notka56 [123]

Answer:

Following are the solution to this question:

Explanation:

The E-government implies use as part of the government systems to offer SMART, which is used to manage smart governance, ethics or accountability, sensitivity, and transparency. It is the research teams, that also shown that policies were progressing in India's creation of information technology. It is also argued against reducing the risk of bribery through improved public official surveillance and reducing its need for citizen engagement with porters with key services.

6 0
3 years ago
What is the function of a bread crumb trial in a website
joja [24]

Answer:

A “breadcrumb” (or “breadcrumb trail”) is a type of secondary navigation scheme that reveals the user's location in a website or Web application. The term comes from the Hansel and Gretel fairy tale in which the two title children drop breadcrumbs to form a trail back to their home.

Explanation:

A breadcrumb or breadcrumb trail is a graphical control element frequently used as a navigational aid in user interfaces and on web pages. It allows users to keep track and maintain awareness of their locations within programs, documents, or websites. Breadcrumbs make it easier for users to navigate a website – and they encourage users to browse other sections of the site. ... You head to their site and end up on The Nestle company history page. Using their breadcrumbs, you can easily navigate back to About Us, History, or even their home page.

6 0
3 years ago
A ____ may be composed of a few individual objects or several complex groups of objects.
Diano4ka-milaya [45]
A mixture can be composed of a few individual objects or several complex groups of objects.

Hope I helped! ( Smiles )
4 0
3 years ago
Other questions:
  • When are numbered lists generally used?
    14·2 answers
  • Which fingers should you use to type the reach keys?
    12·1 answer
  • Arrays are described as immutable because they are two dimensional. are arranged sequentially. can be reordered. cannot be chang
    13·1 answer
  • Eight what makes one character
    14·1 answer
  • It’s been six months since the disk crash at CSM Tech Publishing, and the owner is breathing a little easier because you install
    7·1 answer
  • Private sharing model on Opportunities. Leadership has asked the Administrator to create a new custom object that will track cus
    7·1 answer
  • Which is a common problem for inserting pictures into placeholders?
    10·1 answer
  • 1. What makes discrimination different from harassment? (Don't give me definitions.)
    5·1 answer
  • Using Phyton
    9·1 answer
  • Discovery of a vulnerability in a software program can potentially be sold to the government. Group of answer choices True False
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!