Possible Duplicate:
c++ converting string to int
I have the user input 9 numbers in sequence. I need to convert the string numbers to an int
string num;
int num_int, product[10];
cout << "enter numbers";
cin >> num;
for(int i =0; i<10; i++){
product[i] = num[i] * 5; //I need the int value of num*5
}
Why don't you just read immediately to an integer?
int num;
cin >> num;
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