Fill array faster

Lately i was trying to figure out a way to fill an array of type ‘int’ without using any kind of loops/iterations. So, somehow i figured out this : Online Compiler and IDE >> C/C++, Java, PHP, Python, Perl and 70+ other compilers and interpreters - Ideone.com
This works fine with interactive console i.e the output is : 2147483648.
But when i use an online compiler like ideone which allows you to enter the input before compilation in text form then it shows no output. Why is it happening ?
P.S. I’m a beginner.
Thanks.

1 Like

If you want to ignore the rest of the line, use:

  cin.ignore(numeric_limits<streamsize>::max(), '\n');

not:

cin.ignore();

It’s hard to tell how much whitespace there is after the 10 - the latter will work only if there is one character’s worth.

2 Likes

Thanks! it worked. :smile:

1 Like