The program is this :
Write a program which takes 10 integer numbers from user. Save all the positive numbers to one file, all the negative numbersto another file.
So,the coding will be compare all integers with 0 and save according in two different files right?
If I am right then how to store it in files?
Can we save it in already existed file?
or we have to create one then save it?
And what is the syntax to do this?
Jump to Post
You need to open both files before doing anything and keep them open until the program is done comparing numbers. Opening files is very time consuming, so just open once during the lifetime of the program.
open file1 open file2 start of loop and repeat 10 times …
All 8 Replies
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.