#include "..\CookHeader.h"

Array <int> dataAry = { 188, 150, 168, 162, 105, 120, 177, 50 };

int seqSearch(Array <int> ary, int fData) {
	int pos = -1;
	int sz = len(ary);
	print("## 비교한 데이터 ==>");
	for (int i = 0; i < sz; i++) {
		print(ary[i]);
		if (ary[i] == fData) {
			pos = i;
			break;
		}
		else if (ary[i] > fData) {
				break;
		}
	}
	println("");
	return pos;
}

int main() {
	sortArray(dataAry);
	int findData;
	input(findData, "* 찾을 값을 입력하세요. -->");
	print("배열-->");
	printArray(dataAry);
	int position = seqSearch(dataAry, findData);
	if (position == -1) {
		println(to_string(findData) + "이(가) 없네요.");
	}
	else {
		println(to_string(findData) + "은(는) " + to_string(position) + " 위치에 있음");
	}
}