new to programming, need help!

#include<stdio.h>
#include
#include
int main()
{
int t=0;
std:: cin>>t;

int num[t];
int n=0;

for(n=0; n<t; n++)
{
	std:: cin>>num[n];
}

std:: sort(num,num+t);

for(n=0; n<t; n++)
{
	std:: cout<<num[n];
}

return 0;

}

Can anyone tell me what’s wrong with the cout<<num[n]?
Thanks in advancee :smiley:

The problem statement says you should print each number in a new line which cout does not do by default.

So just change “std:: cout << num[n];” to “std:: cout << num[n]<<”\n";" and it runs fine.

1 Like
//