Warning 11.4.1.
You will only be able to use datafiles in programs that are set up to include them. Make sure to check the instructions for any exercises as to what datafiles are available for use in that program.
Numbers.txt
:
Data: Numbers.txt
10 20 30 40 50 60
"Numbers.txt"
to specify that file.
C:\Programs\HelloWorld
or \home\astudent\HelloWorld
). But it is possible to be currently working in one directory and launch a program that is somewhere else.
ofstream
and ifstream
. The stream part of the name refers to a general idea - a βstreamβ of data that is produced by one thing and consumed by another.
cin
and cout
are streams that send data between the console and a program. cin
is an input stream, it bring information from the console to the program. cout
on the other hand is an output stream that sends data from the program to the console. Each time we use >>
or <<
we are either removing some data from a stream or inserting some data into it.