Finden Sie KTH Max und Min -Element in einem Array

#include <bits/stdc++.h> 
using namespace std;

int main(){
  	const int size = 10;
  	int k = 3; //Can be any number smalled than size
	int array[size] = {5,2,8,34,73,82,1,6,19,29};
	sort(array,array+size);
	int smallestKthElement = array[k-1];	
	int largestKthElement = array[size-k];
}
Shy Skipper