Debug the errors found at the program (the value must be found at location 2): #include using namespace std; int main {   int values = {2, 6, 9, 7};   if (sequential(values, 4, 7) != -1)    cout << "Value is found at location: " << sequential(values, 4, 9) << endl;     else    cout << "Value is not found!"  endl;    } int sequential(int array, int size, int search) {   int loc = 0;   for (int i=0; i< ; i++)     if ( == array[i])     {       loc = i;       break     }   return(); }

Microsoft Visual C#
7th Edition
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Joyce, Farrell.
Chapter7: Using Methods
Section: Chapter Questions
Problem 3RQ
icon
Related questions
Question

Debug the errors found at the program (the value must be found at location 2):

#include <iostream>
using namespace std;

int main
{
  int values = {2, 6, 9, 7};
  if (sequential(values, 4, 7) != -1)
   cout << "Value is found at location: " << sequential(values, 4, 9) << endl;  
  else
   cout << "Value is not found!"  endl;
  
}

int sequential(int array, int size, int search)
{
  int loc = 0;
  for (int i=0; i< ; i++)
    if ( == array[i])
    {
      loc = i;
      break
    }
  return();
}

Expert Solution
steps

Step by step

Solved in 4 steps with 3 images

Blurred answer
Knowledge Booster
Function Arguments
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,