A program reads data from a text file, splits the data depending on its content and stores the separated data into different files. The text file TheData.txt contains 72 lines of data. Each line of data has an integer number and a string colour that are separated by a comma. For example, the first line in the file is: 10 , red The integer is 10 and the string is "red" The file contains six different colours: red, green, blue, orange, yellow, pink. The procedure StoreData(): - takes two parameters: a 1D array DataToStore and a filename - opens the text file with the filename that is passed as a parameter - appends each item of data from DataToStore to a new line in the text file - uses exception handling when opening and writing data to the text file. Write program code for StoreData ()

Computer Science
IGCSE&ALevel
CAIE
Exam No:9618_s25_qp_41 Year:2025 Question No:2(c)

Answer:







Knowledge points:

20.2 File Processing and Exception Handling

Solution:

Download APP for more features
1. Tons of answers.
2. Smarter Al tools enhance your learning journey.
IOS
Download
Android
Download
Google Play
Download