Question: in c plus 8 . 6 . 1 : Write a function that cleans a string containing an integer and converts it . 5 7

in c plus 8.6.1: Write a function that cleans a string containing an integer and converts it.
577648.3479862.qx3zqy7
When reading data from a text file, it is common to see numbers such as 12,345, $20, or 195*.
Write a function that cleans a string containing digits by removing any characters that are not a digit or a - sign. Then convert to an integer and return the result.
3456789101112131415161718192021
#include using namespace std;/** Cleans a string containing an integer and converts it. @param number a string containing an integer and possibly extraneous characters @return the value of the number inside the string*/int clean(string number){/* Your code goes here */}int main(){ string str; cin >> str;

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!