0

How to put arrays elements by user?

If i create an array with 5 elements and i want instant of define those variables in beginning i want user to define them. How can i write that code?

15th Mar 2017, 2:54 PM
Shuvam Pal
Shuvam Pal - avatar
1 Answer
+ 4
Use a for loop: for(int i=0;i<size;i++) cin>>arr[i]; But, the user also needs to input the size before entering the array...
16th Mar 2017, 8:44 AM
Solo Wanderer 4315
Solo Wanderer 4315 - avatar