Linear search - 1. Looking for an error
Задача
Consider an example program that finds an element equal to
5
in an array.
#include <iostream>
using namespace std;
main()
{
int A[5]={1, 5, 3, 2, 5}, i, M, N, X;
cin>> x;
i=0;
while (A[i]!=X)
i = i + 1;
cout << A<< "[" << i << "]=" << x;
}
From the following X
variable values, choose the one that produces the wrong result.
1
3
4
5
In your answer, indicate the value of the variable Х
from the specified ones.
Выберите правильный ответ, либо введите его в поле ввода
Комментарий учителя