|
|||||
|
|
#1 |
|
|
(say string s; cin>>s1; the input accepted via cin is now stored in string s) How to convert this into integer ? say user inputs 99. How to covert this string (99) into integer value of 99. |
|
|
#2 |
|
|
> The input via "cin" is string. right ? > (say string s; cin>>s1; the input accepted via cin is now stored in string s) > > How to convert this into integer ? > > say user inputs 99. How to covert this string (99) into integer value of 99. Please search google groups for "convert string to integer C++" (without the quotes). |
|
|
#3 |
|
|
"mark" <markstone23@yahoo.com> wrote in message news:5e41994c.0406191858.6ed7b9f7@posting.google.c om... > The input via "cin" is string. right ? Wrong > (say string s; cin>>s1; the input accepted via cin is now stored in string s) Right > > How to convert this into integer ? > > say user inputs 99. How to covert this string (99) into integer value of 99. #include <stdlib.h> int n = atoi(s.c_str()); There are many other ways as well. john |
|
|
#4 |
|
|
markstone23@yahoo.com (mark) wrote in
news:5e41994c.0406191858.6ed7b9f7@posting.google.c om: > The input via "cin" is string. right ? You can also input into an int: int a; cin >> a; |