+ 1
How would you convert a string to a int?
6 Réponses
+ 14
// In C++
#include <iostream>
#include <string>
using namespace std;
int main()
{
string str = "12345"; // a string of numbers
for (const auto &i : str) cout << (i - '0') << endl;
}
Output:
1
2
3
4
5
0
java
0
For example:
int age;
double weight, height;
double weightin= weight/2.2;
double heightpo= height*0.39;
double BMR= 6.2*weight + 12.7*height - 6.76*age+66;
how would I convert this using the double.parsedouble() and integer.parseInteger (); ?
0
thankyou