1 Replies - 319 Views - Last Post: 03 April 2013 - 10:38 PM Rate Topic: -----

#1 BobSacamento  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 8
  • Joined: 27-February 13

Question about data input/output

Posted 03 April 2013 - 09:22 PM

Hello,

This is my first time using the #include <fstream>. I was provided with a data field to import into C++ for HW, I am having trouble opening the file. Do I need to make a separate c++ program just for the data field? Any help is appreciated.
Is This A Good Question/Topic? 0
  • +

Replies To: Question about data input/output

#2 Salem_c  Icon User is offline

  • void main'ers are DOOMED
  • member icon

Reputation: 1708
  • View blog
  • Posts: 3,286
  • Joined: 30-May 10

Re: Question about data input/output

Posted 03 April 2013 - 10:38 PM

Well if you were reading two integers from the user, you would use say
cin >> x >> y;

To read those same two integers from a file, you would use
ifstream fin("file.txt");
fin >> x >> y;
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1