I'm sure there is a better way of doing this conversion. Any suggestions?
Read 2 file names from the console.
The first file contains real (fractional) numbers, separated by spaces. For example, 3.1415.
Round the numbers to integers and write them, separated by spaces, to the second file.
Close the streams.
3.49 => 3
3.50 => 4
3.51 => 4
-3.49 => -3
-3.50 => -3
-3.51 => -4
Requirements:
- The program should read a file name twice from the console.
- Create an input stream for the first file. Create an output stream for the second file.
- Read the numbers from the first file, round them, and write them to the second file, separated by spaces.
- The rounding must be performed as indicated in the task.
- The file streams must be closed.
3.49 3.50 3.51 -3.49 -3.50 -3.51 0