Ask Question

Use an ifstream object named indata to read the first three integers from a file called lottowins and write each number to standard output, on a line by itself. Assume that an ifstream object named indata has already been declared. Write code that uses the indata object to open a file named "lottowins". Then, read the first three integers from the file and write each number to standard output, on a line by itself. Last, close the file.

+3
Answers (1)
  1. 8 November, 23:19
    0
    int x;

    indata. open ("lottowins");

    indata >> x;

    cout << x << endl;

    indata >> x;

    cout << x << endl;

    indata >> x;

    cout << x << endl;

    indata. close ();
Know the Answer?