In tubosort the question is this
Given the list of numbers, you are to sort them in non decreasing order
Input
t – the number of numbers in list, then t lines follow [t <= 10^6].
Each line contains one integer: N [0 <= N <= 10^6]
Output
Output given numbers in non decreasing order.
Example
Input:
5
5
3
6
7
1
Output:
1
3
5
6
7
my coding is this
#include< iostream>
using namespace std;
int main()
{ int n,t,k[40];
cin>>n;
for(int i=0;i< n;i++)
cin>>k[i];
for(int j=0;j< n;j++)
{ int min=k[j],pos=j;
for(int l=j+1;l<n;l++)
{ if(min>k[l])
{min=k[l];
pos=l;} }
t=k[j];
k[j]=k[pos];
k[pos]=t;
}
for(int m=0;m< n;m++)
cout<< k[m]<<"\n";
return 0;
}
i am getting a runtimerror, what mistake is in my code?