Sorting even numbers from a file

  • 16
  • Locked
If one ordered isomorph isn't sure if another ordered isomorph is sober, he asks him to pass a simple test: read a file name from the console, read a set of numbers from the file, sort only the even numbers in ascending order, and then display them on the screen. Can you pass?
You can't complete this task, because you're not signed in.
  • Popular
  • New
  • Old
You must be signed in to leave a comment
MBCLevel 14 , Apeldoorn
6 February, 14:48
I have tested it myself and it works, but the tests claim that it doesn't print anything. even though it does do it in ascending order
MBCLevel 14 , Apeldoorn
5 February, 15:09
Does anyone know what the issue with my
might be?
OlehLevel 32 , Kyiv
28 February 2019, 12:36
Lost bunch of time before my first try to verify task on fixing bug. But to the surprise verifier doesn't even check this scenario. The problem was that last line of file didn't read. My algorithm was next: 1. Read file by bytes; 2. Save byte to the buffer if it doesn't equal 10 (ASCII's end of line) ; 3. If byte equals 10 then convert buffer to the string (and then to the int) 4. Add converted buffer to the arraylist. 5. erase buffer So as you can see, if there is no empty line in the end then last number doesn't add to the arraylist either. How can i check end of file, if i am using P.S. Should i create this question in the help section even i already completed the task?
IvanLevel 20 , Nope
3 December 2019, 08:09
You can do so, it is always helpful to have guidance on tasks!