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
Case Study/Scenario: First, Julio clicks Tools from the Chrome menu on the toolbar. Next, he looks for Manage Add-Ons but can no
Margarita [4]

Answer:

Follows are the solution to this question:

Explanation:

Throughout this scenario, Julio chooses the wrong way to handle the add-ons, instead, he opens the option to search and then type add-ons, where the manager can search for add-ons. It is a software extension that provides an application of additional features. It can broaden certain features, introduce additional features to just the interface surface, or provide extra capabilities for both the system.

4 0
3 years ago
Please help ASAP!
makkiz [27]
B. training is the correct answer
8 0
2 years ago
What is the name for the individual sections of the ribbon in PowerPoint 20162
Julli [10]

Answer:

Tabs

Explanation:

The ribbon contains the tabs. The tabs contain the command groups which hold commands

IF THIS HELPS PLEASE MARK THIS ANSWER AS BRAINLIEST

6 0
3 years ago
A centralized structure does not provide information from local stores that would be useful in changing its technology quickly.
mylen [45]
<span>The statement that "A centralized structure does not provide information from local stores that would be useful in changing its technology quickly is an example that illustrates the effect of structure on strategy" is true. 
</span><span> Changes in the external environment are the reason why changes in the technology and emergence of dynamic technological advancements should be done.</span>
7 0
3 years ago
What are the data types in access​
Julli [10]

Answer:

Data type in Microsoft Access Database

Text  

Memo  

Byte  

Integer

Long  

Single  

Double  

Currency  

AutoNumber  

Date/Time  

Yes/No  

Ole Object  

Hyperlink  

Lookup Wizard

Explanation:

4 0
3 years ago
Other questions:
  • The specifications for ____ are developed by the world wide web consortium (w3c) and are continually evolving.
    13·1 answer
  • Cell height can be changed by. Select all that apply
    15·2 answers
  • Indexed sequential access, an index is more useful when the number of record is
    10·1 answer
  • What is the name of the file manager in Microsoft Windows. The file manager used in Microsoft Windows is?
    12·2 answers
  • Where do you define parameter variables?
    14·1 answer
  • In troubleshooting a boot problem, what is the advantage of restoring all BIOS settings to their default values?
    6·1 answer
  • Discuss how 3D modeling enhances animation.
    13·1 answer
  • Based on the following quote from Leonardo Da Vinci, what would be his definition of a fine artist? “Principles for the Developm
    11·2 answers
  • 4. In computers, an integer can be represented by more than 8-bit, what is the largest positive integer that
    9·1 answer
  • What will be displayed after this code segment is run?
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!