Hi
i was following a tutorial but i stuck at something i don't understand it
This is to find out how many times a number appeered inside an array
sorry for my English
#include <iostream>
#include <conio.h>
using namespace std;
int main()
{
const int size = 5;
int arr[size] = { 0, 0, 0, 0, 0 };
int num[size] = { 1, 4, 5, 1, 4 };
for (int i = 0; i < size; ++i)
{
arr[num[i]] += 1; //I don't understand this part, doesn't this suppossed to to increase each value in arr[5] by 1?
}
for (int i = 0; i < size; ++i)
{
cout << i << ": " << arr[i] << endl;
}
_getch();
return 0;
}