0
Please make correct while loop in the function.
4 Answers
0
Blurred list
Given is a set A with elements of integers greater than 0. In addition, we have two constants m and v greater than 0. We define a new set B with the following rule: the integer x belongs to the set B exactly when at most m is lesser than and for v greater than some element of the set A. In other words, B contains, in addition to each element of the set A, the previous m and the following v integers. We do not know the size of the set A, we access it with the next () function, which we write ourselves. With each call, it returns one element of set A. When it reaches the end of the set, it returns -1. The function prints out the elements of set B in real time before reading the next element of set A should write all those elements of set B that we assume belong to this set.
Example:
int m=2, v=1;
A={1,3,4,9};
Than B={-1,0,1,2,3,4,5,6,7,8,9,10};
0
But I try to study . If anyone knows the principles of programming languages, he should know what my exercise wants.