Ignoring extraneous characters in input

Hey! Working on a project and I need help with ignoring extraneous characters. For the input you have to input a dollar amount (ex. 1000). I need to write in C++ to accept the input but also to either accept or just ignore extraneous characters. I've seen other archived answers but they don't answer my question really. I need it to ignore stuff like "$ 1000" or "$1000" or "1000 dollars" and just accept the numeric characters. Any ideas?
Maybe you could use cin.peek()?
how so? this is my code

1
2
    cout << "What is your loan amount? ($ Amount)";
    cin >> loanamt;


how can I use cin.peek
Topic archived. No new replies allowed.