int n = 10;
int a[n];
for (int i = 0; i < n; i++)
{
cin >> a[i];
}
This is how I input array when we know the size of n
. But when we don't know the size of n
and we have to take input in an array and stop taking inputs when there is a new line. How can we do that in C++?