Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

infile/outfile program

Status
Not open for further replies.

boobyforkman

Programmer
Joined
Jun 13, 2003
Messages
3
Location
US
i need to write a program that asks for users name address, city, state, and zip code.
the program should hten save the data to a data file.
then the user will be asked if they want to continue or end. names have to be added as long as the user continues. PLEASE HELP! i have no clue where to begin...
 
Starting point? Probably you showing up for class when they teach you how to do this stuff.


cout lets you talk to users.
cin lets them talk to you.

Declaring an ofstream gives you a stream to write to a file.

A while loop can be used to repeat things.
 
i know those thing moron, like it says in the subject, my problem is the infile/outfile stuff
 
You never specified your problem. You only claimed you had no clue where to begin. The "infile/outfile program" is simply the thing about which you lack that clue. Perhaps your problem lies in not having the ability to form a query from which others can infer your problem.


For the output file part, I repeat: "Declaring an ofstream gives you a stream to write to a file."

Your problem description says nothing about an input file. However, declaring an ifstream gives you a stream to read from a file.

Two starting points, then: ifstream and ofstream.

Usage example:
Code:
ofstream fout( "moron.txt" ); // opens a file

fout << &quot;blah.&quot;;  // write to that file

ifstream is similar.


Also, a bit of advice: if you're going to insult someone's intelligence, at least use proper grammar in doing so; otherwise it's just a joke.
 
thanks chipper, and i apologize for my insult, i was aggravated for other reasons, and i shouldnt have insulted you, but i really do appreciate the help
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top