Important: Not to add cin in line 23 because #1, getchar (void) is equivalent to getc(stdin) which doesn't needs passing on value using cin; #2, cin only handles characters without space and it's not useful here as we have to use space to separate between different numbers; #3, when cin is used, the stdin pointer is moved forward to take off the parts that are read by cin.