#C13574. Interactive To-Do List Manager
Interactive To-Do List Manager
Interactive To-Do List Manager
This problem requires you to implement an interactive to-do list manager. You need to process user commands from stdin to add tasks, mark tasks as completed, and display the current tasks. The program should repeatedly present a menu of options until the user chooses to exit. The commands and responses should strictly follow the format described in the problem statement. No extra output or formatting is allowed.
Specifically, the menu options are:
- 1: Add task
- 2: Complete task
- 3: Show tasks
- 4: Exit
For option 1, the program should prompt for a task description and then print "Added task: [task]". For option 2, it should prompt for a task and then either print "Completed task: [task]" if the task exists or "Task not found: [task]" if it does not. For option 3, the program should print the list of current tasks in the order they were added.
Use stdin for all inputs and stdout for all outputs. All numerical inputs and prompts must exactly match the specified format.
inputFormat
The input consists of a sequence of commands provided via stdin. Each command is entered on a separate line. After selecting an option, additional input may be required:
- When the option is 1, a task description is provided on the next line.
- When the option is 2, a task description is also provided on the next line.
- Options 3 and 4 require no additional input.
outputFormat
The output must strictly correspond to the user's commands. For each iteration, the program must print the menu of options and a prompt for input. Depending on the user's choice, further responses are produced:
- For option 1: after receiving the task, print "Added task: [task]".
- For option 2: after receiving the task, print either "Completed task: [task]" or "Task not found: [task]".
- For option 3: print "Current tasks:" followed by each task on a new line prefixed by "- " (a hyphen and a space).
- For option 4: print "Exiting..." and terminate.
All prompts and messages must be printed exactly as specified, including newlines.
## sample1
Task 1
3
4
Options:
1: Add task
2: Complete task
3: Show tasks
4: Exit
Choose an option: Enter a task to add: Added task: Task 1
Options:
1: Add task
2: Complete task
3: Show tasks
4: Exit
Choose an option: Current tasks:
- Task 1
Options:
1: Add task
2: Complete task
3: Show tasks
4: Exit
Choose an option: Exiting...
</p>