Consider the following program segment. ifstream inFile; //Line 1 int x, y; //Line 2 ... //Line 3 inFile >> x >> y; //Line 4 Which of the following statements at Line 3 can be used to open the file progdata.dat and input data from this file into x and y at Line 4?

Respuesta :

ijeggs

Answer:

inFile.open("progdata.dat");

Explanation:

This command opens the file which is passed to it as an argument. We are quite used to the C++'s cin and cout functions contained in iostream library for reading and writing data, however, when working will real-life stuff, we find ourselves working with huge data saved as separate files and require our programs to read them, manipulate them and possibly write back to the files... The first operation usually carried out before a file can be read or written to is open

ACCESS MORE