cplusplus
.com
TUTORIALS
REFERENCE
ARTICLES
FORUM
C++
Tutorials
Reference
Articles
Forum
Forum
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Lounge
Jobs
Forum
Beginners
(C++) Read numbers from text file
(C++) Read numbers from text file
Jan 8, 2015 at 8:08pm UTC
yonutbanu
(2)
I have a text file that looks like this:
1
2
3
4
5
6
I want to read this numbers and put them into a vector. How do I do that?
Jan 8, 2015 at 9:11pm UTC
tcs
(519)
1. Define a vector (see Cplusplus.com Reference for Container).
2. Open the file (see Cplusplus.com Reference for IOstream).
3. In a loop do read your numbers and put them into the vector.
4. Close your file and terminate your process.
Topic archived. No new replies allowed.