Question is:
"Write a complete program that writes into a file from an array of string and also in reverse
order."

Please help

Recommended Answers

All 2 Replies

Again, be specific with the areas of difficulty...

An array of strings? My question is, suppose you had the array:

{ "me", "you", "us" }

Does the output need to be reversed like "us", "you", "me" (if so, just start at the last index and move backwards), or "su" "uoy" "em"...

Either way, you should be able to think about it...simple manipulation...

The problem requires you being able to write to a file (which you should understand, if not google search it...), and pass through an array...again, you should be able to handle this...but post back with your attempted code and specific areas of difficulty.

you need to use file streams found in fstream.h..here is a simple implementation example

ofstream outfile; 
outfile.open("file.txt"); // open the file for writing
outfile<< /*your array here*/;
outfile.close();

the above is just giving an idea on how you should go about it..hope it helps

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.