### Find largest prime number k of array 1

I'm having this problem.
While finding the primes , I do not know how to make it into one array so that...
Your problem is not clear. Please show what you are trying to do.
Find kth largest element

 ``12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273`` ``````#include #include #include #include #include using namespace std; void Input_Array(int a[],int n) { srand(time_t(NULL)); for(int i = 0; i < n;i++) { a[i] = rand() % 90; } } void Print_Array(int a[],int n) { for(int i = 0; i < n; i++) { cout<<" "<0) { for(int i = 0;i < n;i++) { for(int j = i+1; j < n; j++) { if(a[i] > a[j]) swap(a[i],a[j]); } cout<<" "<>n; Input_Array(a,n); Print_Array(a,n); cout<<"\nInput k :"; cin>>k; cout<<"\nElement largest "<
Are you trying to find prime numbers or largest element? I don't see anything in here that tests primality.
ex:
a = {5 8 1 3 9 6 10}
k = 3
Print >>8
I don't understand that output at all. You're going to have to explain why you want that to happen.
It's a typical heap problem, you can start from this data structure first.
sorry to be on my phone, and hard to write full code, feel free to ping me if you cannot fully understand the heap.
Are you trying to find the kth largest element in the array?

Then just sort the array in descending order and output the kth element.
Topic archived. No new replies allowed.