c++ - Converting from string to int with a function -


I'm quite new to programming and I'm trying to use a function that changes the string to an int Gives. My idea with this function was to collect every number in the string and store it in another string, then convert it to an integer.

The function value 0 returns.

What is this function to return the confirmed number which should not be 0

  int getNumberFromString (int changed number, string text tutorial) {for (int i = 0; i & lt; textToConvert.size (); i ++) {string collectNumbers; Int j = 0; If (textconvert [ii] == '1' || textconvert [i] == '2' || textonvert [i] == '3' || textonvert [i] == '4' || textconvert [i] Text == '5' || | Textconvert [i] == '0') {Collection number [J] = Text tutorial [i]; J ++; } If (Submit Signs.) (== 0) {Return False; } And if (Score)) (SEC) (gt; 0) {stringstream Convert (Combined Number); If (! (Rupees & gt; & nbsp; converted number)) {convertedNumber = 0; } Return changed number; }}}}    

Perhaps you should use only the library function?

  int store (const string and str, size_t * idx = 0, int base = 10);    

Comments

Popular posts from this blog

Verilog Error: output or inout port "Q" must be connected to a structural net expression -

jasper reports - How to center align barcode using jasperreports and barcode4j -

c# - ASP.NET MVC - Attaching an entity of type 'MODELNAME' failed because another entity of the same type already has the same primary key value -