Question: Suppose you wrote a program that reads data from cin . You are now required to reimplement it so that you can read data from

Suppose you wrote a program that reads data fromcin. You are now required to reimplement it so that you can read data from a file. You are considering the following changes.
I. Declare anifstreamvariablein_file
II. Replace all occurrences ofcinwithin_file
III. Replace all occurrences of>>andget_linewith the appropriate operations forifstreamobjects
What changes do you need to make?
Suppose you wrote a program that reads data fromcin. You are now required to reimplement it so that you can read data from a file. You are considering the following changes.
I. Declare anifstreamvariablein_file
II. Replace all occurrences ofcinwithin_file
III. Replace all occurrences of>>andget_linewith the appropriate operations forifstreamobjects
What changes do you need to make?
I and III
II and III
I, II, and III
I and II

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!