-2

I need a way to read input data which can

  1. read until end of file (int variables).

  2. read until end of line (int variables).

    example input file :

    1 2 3 4

    3 2 3

    I need :

    Put all numbers in line 1 to first array.

    Put all numbers in line 2 to second array.

  3. can use for online compiler : ideone, codeforces,...

  4. can read from file.

and a way print output which can

  1. print double with two decimal numbers double i = 1.2355 ; print 1.24
  2. can use for online compiler

And the most important things is speed. And simple to use.

Which should i use and how to use it ?

Anh Huynh
  • 96
  • 5
  • 2
    This question is way too broad. Try to narrow the scope of your question down. There isn't anything specified so far that can't be handled by the standard library, though. –  Nov 29 '14 at 09:58
  • If you can't use streams(madness situation), you can use standard function fscanf(). – Ivan Nov 29 '14 at 10:01
  • Plese show me how to use for each above. Nomarlly, i use cin/cout/freopen but when i need to read until eof,eoln i use ifstream/ofstream, and when i need to print double with two decimal numbers i have to use printf. It's too much complex. – Anh Huynh Nov 29 '14 at 10:09

1 Answers1

0

For learning C++, I recommend a book like The C++ Programming Language (4th Edition) and A Tour of C++, the latter of which is meant to be a reference for the standard library. There are many facilities in the standard library such as streams and containers which are designed to be easy to use. They also tend to be more efficient than homebrew solutions, but that is a quality of implementation issue.

Community
  • 1
  • 1