Question

(Create a binary data file) Write a program to create a file named CreateBinaryFile.dat if it...

(Create a binary data file) Write a program to create a file named CreateBinaryFile.dat if it does not exist. Append new data to it if it already exists. Write 50 integers created randomly into the file using binary I/O.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Using C Programming language:-

1st image is the code for creating a Binaryfile.dat

1) .dat file can be opened by notepad.

2) In the program I generate the 50 numbers below 100 only.

3) You can generate any 50 values by changing the 100 to your desired value

ex:- 100000000 ( the program generates 50 values from your value).

4) You can change this in the line n=rand()%100+1.

5) 2nd image is the output

6) we cannot see the output in the compiler.

7) The program directly writes the output (50 random numbers) in the BinaryFile.dat

2nd image is the output

we cannot see the output in the compiler.

The program directly writes the output (50 random numbers) in the BinaryFile.dat

Add a comment
Know the answer?
Add Answer to:
(Create a binary data file) Write a program to create a file named CreateBinaryFile.dat if it...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Using netbeans to write a program to create a file named CreateBinaryfile.txt if it does not...

    Using netbeans to write a program to create a file named CreateBinaryfile.txt if it does not exist. Append new data to it if it already exists. Write 20 integers created randomly into the file using binary I/O. Thanks.

  • (Create a text file) Write a program to create a file named Exercise17_01.txt if it does...

    (Create a text file) Write a program to create a file named Exercise17_01.txt if it does not exist. Append new data to it if it already exists. Write 150 integers created randomly into the file using text I/O. Integers are separated by a space.

  • Write a program to create a file named integerFile.txt if it does not exist. Write 100...

    Write a program to create a file named integerFile.txt if it does not exist. Write 100 integers created randomly into the file using text I/O. The random integers should be in the range 0 to 100 (including 0 and 100). Integers should be separated by spaces in the file. Read the data back from the file and display the data in increasing order This is what I have so far: import java.io.File; import java.util.Scanner; import java.io.PrintWriter; public class integerFile {...

  • : Files and Exceptions: Write a program to create and use a grade book for a...

    : Files and Exceptions: Write a program to create and use a grade book for a course. The gradebook is created as a file named as “Course_Name.dat” and includes the following information about students: Student ID, First Name, Last Name, and Grade. Assume the following structure for the gradebook file:1.Students’ records are separated by a new-line character.2.No field includes any white-space character, and fields are separated by space.3.The order of the fields is the same for all the records.Based on...

  • 3 Dn Ent Write a python program to create a Dictionary named grade with the given...

    3 Dn Ent Write a python program to create a Dictionary named grade with the given items and do the below operations: i. 15 i. Create Dictionary with keys-{'Monday', 'Tuesday', 'Wednesday Thursday', 'Friday') ii. values-{1, 2, 3, 4, 5) ii. Now append another item with key-'Saturday') and value-(63 to the already created Dictionary and print it.

  • Write a line of code that will declare a file variable named data. Assuming that the...

    Write a line of code that will declare a file variable named data. Assuming that the variable data was correctly created in the previous problem, write a line of code that will associate the variable with a file named grades.txt that is being opened for reading. Assuming that grades.txt only contains integers, write a line of code that will use the variable data to read in the first integer and store in a variable named test1 that has already been...

  • C++ 1. Your program should use named string constant for the file name to open the...

    C++ 1. Your program should use named string constant for the file name to open the file. Do not add any path to the file name because the path on your computer is not likely to exist on the computer the instructor uses to grade the program. Points may be deducted if you don't follow this instruction. 2. Split statements and comments longer than 80 characters into multiple lines and use proper indentations for the split portions. (Lab2b.cpp) Write a...

  • Question 2: Assume that a text file containing a series of integers is named numbers.txt and...

    Question 2: Assume that a text file containing a series of integers is named numbers.txt and exists on the c:Temp. Write a program that reads all of the numbers stored in the file and calculates their total. In order to test this program, you may create a text file using notepad. No GUI is necessary. Name the program number.py

  • Using Spyder (or the IDE of choice), create a new file named Assignment1.py and write a...

    Using Spyder (or the IDE of choice), create a new file named Assignment1.py and write a Python program using the Editor that produces the following output: My name is Razan Abdelgalil. I am taking CIS 195 at Cabrini University. 1 + 1 = 2 (use an arithmetic operator for the calculation)

  • Write a program (a3.py) that has 3 function definitions: magic-sequential(), magic-binary(), and main(). You will write...

    Write a program (a3.py) that has 3 function definitions: magic-sequential(), magic-binary(), and main(). You will write the code for the above functions. Both magic functions (magic-sequential() and magic-binary()) will look for a magic index in a given sorted list of distinct integers. A magic index in a list myList[0 ... n-1] is defined to be an index i such that myList[i] = i . Both functions receive the list as a parameter and return an integer: either the magic index,...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT