Im writing a census program that requires me to use c string objects to read in three things, names(states), population, and area. What I dont know and cant find in my text book, at least in a clear way, is how to read numbers and names from a text file saved separately in my directory. My objects are being declared as ifstream and ofstream.
How do i read in arrays of numbers and streams, using c strings in c++?
If you mean how to read them from the text file, ifstream and ofstream work just like any other stream, such as cin and cout:
ifstream read("census.txt")
string name
int population,area
read %26gt;%26gt; name
read %26gt;%26gt; population
read %26gt;%26gt; area
wedding reception flowers
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment