Inputting space separated numbers

I don’t understand how to input an array of numbers which contains spaces. cin, cin.get and cin.getline are not working.

int n;
cin>>n;

int arr[n];
for (int i=0; i<n; i++)
{
	cin.getline(arr[i]) ;
}

hello @yamika

simply use cin>>arr[i] inside loop

i have one more doubt. why is this code exceeding the time limit?

…

which code? pls save ur complete code at cb ide and share its link with me

updated both the pointers. time limit is still exceeding

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.