Write a program that gives and takes advice on program writing. The program starts by writing a piece of advice to the screen and asking the user to type in a different piece of advice. The program then ends. The next person to run the program receives the advice given by the person who last ran the program. The advice is kept in a file, and the contents of the file change after each run of the program. You can use your editor to enter the initial piece of advice in the file so that the first person who runs the program receives some advice. Allow the user to type in advice of any length so that it can be any number of lines long. The user is told to end his or her advice by pressing the Return key two times. Your program can then test to see that it has reached the end of the input by checking to see when it reads two consecutive occurrences of the character ‘\n‘.

Recommended Answers

All 3 Replies

While Daniweb offers advice, we are not a homework service. As such, please show us what you have done so far and where you are having problems and we will try to help.

Help us to help you. What have you tried so far? Where are you stuck?

Hello there! Here's a piece of advice to get you started: "Test your code early and often - it will save you time and headaches in the long run."

Please type in your own advice below, followed by two newlines (by pressing Enter twice) to end your input:
Strive to write intention-revealing code; use meaningful and descriptive variable names and reduce redundant comments.

Thank you for your advice!

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.