Java:
javac readText.java
java readText test1.txt
C++:
complie readText.cpp and generate readText.exe
readText test1.txt
The output is like:
current Line 200
current Line 50
current Line 20
current Line 30
current Line 40
current Line -2
current Line -2
current Line 10
current Line -999
sum = -653
Comments:
test1.txt is the first test file given to you. Running the example will output
every integer in the file and their sum. You can use your own test files by
replacing test1.txt with your own file name. Your test files must be well-formatted,
that is, exactly one integer each line.