Challenge: Arithmetic Sequence
Explore how to write a C++ program that detects the first outlier in an arithmetic sequence array by analyzing element indices. Learn to handle edge cases such as arrays with less than five elements and develop skills in array manipulation and algorithmic problem solving within C++.
Task
This task requires you to find the index of the first outlier in a given array. All numbers in an array are in an arithmetic sequence except one.
Write a program that uses an array and finds the index of the first outlier and stores it to the variable idx. The array is guaranteed to have at least elements and the first two elements will be in the required arithmetic sequence. The value of the idx should be ...