C++ for Engineers and Scientists
C++ for Engineers and Scientists
4th Edition
ISBN: 9781133187844
Author: Bronson, Gary J.
Publisher: Course Technology Ptr
Question
Book Icon
Chapter 8.4, Problem 2E
Program Plan Intro

Program Plan:

  • Include library files for various operations.
  • Declare required variables.
  • Declare object of ifstream.
  • Declare function header, fcheck()with object of ifstream as a formal parameter.
  • Declare afunctionfcheck()to check that the file exits or not.
  • Useif statement to check that the file exist.
  • Open the file, by using open() method.
  • int main() function is used to perform all the tasks.
  • Display the calculated results to the user.

Program Description: The main purpose of the program is to declare a function, fcheck()to check that the given file exits or not and if the file exist, then function should return 1 otherwise it will return 0.

Blurred answer
Students have asked these similar questions
(FRP7) Write a function that reads data from a file. The file has already been opened and verified. The data should be saved in the array of type ship. The size of the array is passed in the int parameter and the number of records read is return in the last parameter, by reference.  The file should be read until end of file has been reached or the array is full. struct ship{       string shipCaptain;       string shipName; }; The function prototype isvoid readFile( ifstream&, ship[ ], int, int& ); ifstream - The already open file  ship[ ] - array of structs where the data from the file will be stored. int - the size of the array. int& - the number of records read from the file. This value is set by the function before returning return- the number of records read from the file, returned by the function.    The amount of data in the file is unknown but there is no bad data. The file format is the shipsName followed by the shipsCaptiain . Example: MillenniumFalcon   HansSolo
(C++ Language) Create a function that writes to a file named Inventy.txt the information of 8 items. Ask the user for the item's name, the item's quantity in storage, and the item's price and write it to the file. Create a function that reads the file and items' quantity and price to two different arrays. Create a function that computes the subtotal of each item. Implement all functions inside the main program and the computed value should be displayed with the item's name.
(C#)The following statement declares a StreamReader object variable called "inputFile". Which statement opens a file named "data.txt" to the StreamReader object?StreamReader inputFile;   Question 10 options:   inputFile = open("data.txt");   inputFile = OpenFile("data.txt");   inputFile = File.OpenFile("Data.txt");   inputFile = File.OpenText("Data.txt");
Knowledge Booster
Background pattern image
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Text book image
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Text book image
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
Text book image
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Text book image
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Text book image
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education