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
Reptile [31]
2 years ago
13

Consider the following implementation of a search method:

Computers and Technology
2 answers:
antiseptic1488 [7]2 years ago
6 0

Answer:

-1

Explanation:

i = 5 and target is 4, hence the result will be -1 going to the else statement because its not equal to the target

agasfer [191]2 years ago
3 0

Answer:

4

Explanation:

That's what the answer key says.

You might be interested in
What is peopleware?<br>need help​
Oksana_A [137]

Answer:

Peopleware is a term used to refer to one of the three core aspects of computer technology, the other two being hardware and software.

3 0
3 years ago
Can someone tell me how to mark people the brainiest on a laptop?
Crazy boy [7]

When two people give answer to your question, then below their answer you will get a option Mark as Brainliest. You simply need to click that button

7 0
2 years ago
Write a C function that takes an STL vector of int values and determines if all the numbers are different from each other (that
eduard

Answer:

Here is the function:

#include <iostream>  //to use input output functions

#include <vector>  // to use vector (sequence containers)

#include <algorithm>   //use for sequence operations

#include<iterator>  //to move through the elements of sequence or vector

using namespace std;  //to identify objects cin cout

 void DistinctNumbers(std::vector<int> values) { /*function that takes  an STL vector of int values and determines if all the numbers are different from each other */

     sort(values.begin(), values.end());  //sorts the vector elements from start to end

     bool isDistinct = std::adjacent_find(values.begin(), values.end()) == values.end();  //checks for occurrence of two consecutive elements in vector

if(isDistinct==true)  // if all numbers are different from each other

{cout<<"Numbers are distinct";}

else  //if numbers are duplicate or same

{cout<<"Numbers are not distinct";}   }  

int main(){      //start of main function

std::vector<int> v = {1,2,3,4,5};  // vector of int values

DistinctNumbers(v); }  //function call to passing the vector v to check if its elements are distinct

Explanation:

The program that takes an STL vector of int values and the function DistinctNumbers determines if all the numbers are different from each other. It first sorts the contents of the vector in ascending order using sort() method. Then it used the method adjacent_find() to searches the range means from the start to the end of the vector elements, for first occurrence of two consecutive elements that match, and returns an iterator to the first of these two elements, or last if no such pair is found. The result is assigned to a bool type variable isDistinct. It then checks if all the numbers are different and no two adjacent numbers are same. If all the numbers are distinct then this bool variable evaluates to true otherwise false. If the value of isDistinct is true then the message :Numbers are distinct is displayed on screen otherwise message: Numbers are not distinct is displayed in output screen.

7 0
3 years ago
Buenas, podrían ayudarme con alguna suite <br> ofimatica, para que sirve y sus características?
navik [9.2K]

Answer:

Say what?!?

Explanation:

6 0
2 years ago
Write a complete program that declares an integer variable, reads a value from the keyboard into that variable, and writes to st
vovikov84 [41]

Answer:

#include <iostream>

using namespace std;

int main ()

{

int num;

cin>>num;

cout << num<< " " << 2 num << " " << numnum;

return 0;

}

Explanation:

See answer

5 0
3 years ago
Other questions:
  • Identify the six components of an information system. Which are most directly affected by the study of computer security? Which
    8·1 answer
  • By using password-stealing software, ________ capture what is typed on a keyboard and easily obtain enough personal information.
    5·1 answer
  • Which of these is NOT one of the three parts to the event-handling mechanism in Java?
    10·1 answer
  • A project manager type a document and print it he is using
    14·1 answer
  • To enter new code that performs as intended in the place of the old code that produces an error is the goal of
    9·1 answer
  • Write a C++ program that computes an approximation of pi (the mathematical constant used in many trigonometric and calculus appl
    15·1 answer
  • What is a mod in programming?<br><br> Give more Java questions
    12·1 answer
  • The field names in a database are also known as__?
    12·2 answers
  • How many times will the loop body execute:
    7·1 answer
  • What are some of the most common obstacles in video games?
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!