#Removing value form list

7 messages · Page 1 of 1 (latest)

dapper sleet
#

Hello, I was wondering how I would be able to remove a value from a list.
I am working on a to-do list, but there are some problems since I am quite new to working with c++.
Here is the code that I am having trouble with in the program -```c++
#include <iostream>
#include <list>
#include <stdlib.h>
#include <windows.h>

std::list std::string lToDo;

int removeChoice;

int main() {
//Printing the list
for (std::string item : lToDo)
std::cout << counter++ << ". " << item << "\n";

std::cout << "What would you like to remove? ";
std::cin >> removeChoice;
}```
Now I don't really know what to write next in the code, which is the part that will actually remove something from the list.
So if anyone could help me with this, then that would be awesome!

lusty bearBOT
#

When your question is answered use !solved to mark the question as resolved.

Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For tips on how to ask a good question run !howto ask.

dapper sleet
#

how can I erase a specific value tho

wanton monolith
#

you specify the element you want to delete

#

but I assume you want to delete a node with the matching string?

#

realistically you would do a std::find on the string, and remove the element if it finds it