A file named data.txt contains an unknown number of lines, each consisting of a single integer. Write a program that creates the following three files: dataplus.txt dataminus.txt zeros.txt The program should read each line of the data.txt file and perform the following: If the line contains a positive number, that number should be written to the dataplus.txt file. If the line contains a negative number, that number should be written to the dataminus.txt file. If the line contains the value 0, do not write the value to a file. Instead, keep a count of the number of times 0 is read from the data.txt file. After all the lines have been read from the data.txt file, the program should write the count of zeros to the zeros.txt file.
A file named data.txt contains an unknown number of lines, each consisting of a single integer. Write a program that creates the following three files: dataplus.txt dataminus.txt zeros.txt The program should read each line of the data.txt file and perform the following: If the line contains a positive number, that number should be written to the dataplus.txt file. If the line contains a negative number, that number should be written to the dataminus.txt file. If the line contains the value 0, do not write the value to a file. Instead, keep a count of the number of times 0 is read from the data.txt file. After all the lines have been read from the data.txt file, the program should write the count of zeros to the zeros.txt file.
Related questions
Question
A file named data.txt contains an unknown number of lines, each consisting of a single integer.
Write a program that creates the following three files:
-
dataplus.txt
-
dataminus.txt
-
zeros.txt
The program should read each line of the data.txt file and perform the following:
-
If the line contains a positive number, that number should be written to the dataplus.txt file.
-
If the line contains a negative number, that number should be written to the dataminus.txt file.
-
If the line contains the value 0, do not write the value to a file. Instead, keep a count of the number of times 0 is read from the data.txt file.
After all the lines have been read from the data.txt file, the program should write the count of zeros to the zeros.txt file.
Expert Solution

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution!
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 4 images

Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-engineering and related others by exploring similar questions and additional content below.