Try this: int i, k = 0; for (i = 0; i < n; i++) k = 10 * k + a[i];
The c_str() and strcpy() function in C++C++ c_str() function along with C++ String strcpy() function can be used to convert a string to char array easily. The c_str() method represents the sequence of characters in an array of string followed by a null character ('\0').
var arrayOfNumbers = arrayOfStrings.map(Number);
Strings in the console are symbolized by wrapping them in quotes. By that fact, we can assume that i
is a string. Convert it to an integer and it will no longer be a string and no longer have those quotes.
endFlowArray.push(+i);
Your "numbers" in flowEnd
and dateFlow
are actually strings, not numbers.
To convert entire array's data type we can use map()
:
let numberArray = stringArray.map(Number)
try this:
let numberArray = stringArray.map(el=>parseInt(el))
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With