Read from text file and write to different file?

I dont know how to start this, but is there a way I can read from a text file and write into a different file using the text.open function? i dont know much and I have been given a task I find difficult! the spec is below! thanks!

This, the third task in a portfolio of four assesses the following programming concepts:

 Writing To Files
 Iterative Statements (while / for)
 Nested Loops

The ships and their containers we have been working with in Tasks 1 and 2 are part of a commercial port
system. Each ship is either unloaded (empty) or loaded (full assignment of containers inside).
Each loaded ship employs a crew (one or more persons). When a ship is unloaded the crew are not on board
and are not being paid. Similarly once a ship is loaded all the crew are on board and being paid
according to the length of the journey, i.e. until the ship is unloaded at the destination.

A wages calculator application is required that can determine the total cost of crew departing from the
port on that day. To do this, the application reads from an itinerary text file containing each ship being
loaded in the port that day, in the following format:
<ship id>
<journey id>
<l> // where <l> is the length in hours of the journey
<s> // where <s> is the number of crew for the ship for this journey
<rate> // for each s, <rate> is hourly rate of pay

Your application must calculate the total cost of the crew for each ship/journey and then compare it
with a ‘recommended maximum journey cost’ (RM) amount typed in by the user when the application
is first run.

If the total amount is less than or equal to RM then the details must be written to the screen and to an output text file called wagedaily.txt. If the amount is larger than RM then the results must be written to the screen only. Messages to the screen must indicate whether the crew cost is less
than, equal to or larger than RM.

Your application should find the ship with the highest crew cost that is below RM and print this out as
the final piece of output to the screen.

I have the input file with the data in it ready! spoon feed me please i really am a noob
closed account (EwCjE3v7)
ifstream: http://www.cplusplus.com/reference/fstream/ifstream/ifstream/

1
2
3
4
5
std::ifstream file("input.txt");
std::string str;
while (file >> str) {
...
}


ostream:http://www.cplusplus.com/reference/fstream/ofstream/ofstream/
ive never used IFSTREAM so this looks all alien to me
Then its the moment to learn something new.
okay will do, but still as it needs to read from an itienary file, do i need to use the itienary file function or just keep it as a text file?
Topic archived. No new replies allowed.