Programming in C
4th Edition
ISBN: 9780321776419
Author: Stephen G. Kochan
Publisher: Addison-Wesley
expand_more
expand_more
format_list_bulleted
Question
Chapter 15, Problem 2E
Program Plan Intro
Program Plan:
- Include required header files.
- Declare the function “main ()”.
- Declare a file pointer named “outputfile”.
- Open the file “outputfile.txt” using the function “fopen ()”.
- Declare an array named “Fibonacci []” with size 15.
- Assign the value 0 the 0th index of the array and assign the value 1 to the 1st index of the array.
- Loop from 2 through 15 using “for” loop.
- Calculate Fibonacci number and store the values in the array.
- Loop from 0 through 15 using “for” loop.
- Print a new line the output file.
- Print the values of the array into the file.
- Close the file using the function “fclose ()”.
- Return the statement.
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
What is the difference between a binary file and a text file? Is it possible to use a text editor to see a text or binary file?
The Problem: Our program uses binary files as input. How can we be sure we get the right binary files?
It's up to you to suggest how the file's structure might be improved.
Chapter 15 Solutions
Programming in C
Ch. 15 - Type in and run the three programs presented in...Ch. 15 - Prob. 2ECh. 15 - Write a program to copy one file to another,...Ch. 15 - Write a program that merges lines alternately from...Ch. 15 - Write a program that writes columns m through n of...Ch. 15 - Write a program that displays the contents of a...
Knowledge Booster
Similar questions
- Considering that an ASCII file contains just letters and numbers, how much space might be saved by reducing the size of the file? What methods would you use to accomplish this reduction?arrow_forwardI need to modify this code to be able to read from a file and write into a file. The program is working as it should but I need an example of how to change my input and accept a file instead.arrow_forwardFind out what the purpose of a file's extension is and how it affects the file you're now editing. This is an easy idea to grasp.arrow_forward
- What is the difference between a text and a binary file? Can you use a text editor to see a text or binary file?arrow_forwardWhere exactly are you in the file in terms of the read position? Where do you begin reading the file for the first time?arrow_forwardCan you explain what a file is? Why is it necessary to "open" and "close" a file? Suppose we do it that way, what will happen?arrow_forward
- You've created a PPT file contains a lot of pictures and two videos, The file size was X MB. You have to decrease the size of the file without deleting the objects Inserted on it. Suggest a solution.arrow_forwardYou have been tasked to write a C++ program that will go through the first step of encrypting an input file and writing the encrypted contents to an output file.For each letter read in from the input file, add 3 letters to the value of the input letter. If the input letter is an A then the encrypted letter would be a D. If the input letter from the input file is an X then the encrypted letter would be an A. All spaces, digits, punctuation, and special characters do not need to be encrypted at this level. Simply write the space, punctuation, or special character to the output file as is. If a letter is uppercase in the input file, it should remain as an uppercase character in the output file. If a letter is lowercase in the input file, it should remain as a lowercase character in the output file.Since this program runs each month, the input file will be of various lengths; therefore, the program will read until end of file.The input file is found in the current directory and is…arrow_forwardWhat do you think is the importance of having a format (e.g. for each line of the file, the data are separated by a comma) when storing the data generated by your program to files?arrow_forward
- Create two programs that processes data with file I/O, nested loops, and other logic Read data from the first text file, loop through the second text file, and do something. Output something to a third text file.arrow_forwardThere are two sorts of files in general: text files and picture files. Which of these two file formats is regarded as more advantageous?arrow_forwardOften we get large amounts of data. You are to take two numbers from the user, write divide the two numbers (num1 / num2) , and save that information to a file. The numbers might have a lot of decimal places, so clean it up to be just two decimal places.arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education