Hello!
I have just started with arrays and I have a question. I have been asigned to make a program that asks the user to write in numbers in an array.
I have got far enough to make it happen and the program works perfectly, just a small thing - I need help making it smaller (if possible).
Because right now it looks like a mess. It has to be possible to make it smaller.
kemort hit the nail on the head. The beauty of arrays (and why they are used in the first place) is that they are indexed, so you can loop through them with ease. For example, if you wanted to assign the number one to every element in an array:
1 2 3 4 5
int number[8];
for (int i = 0; i < 8; i++) {
number[i] = 1;
}
Now try to do the same for the what you have to do. ;)