Comment on Tutorial - atoi(), itoa() in C++ By Manoj Kumar



Comment Added by : Anonymous

Comment Added at : 2009-06-07 21:00:18

Comment on Tutorial : atoi(), itoa() in C++ By Manoj Kumar
i'm really hoping this example was wrote before 1998, you know, before c++ standard
iostream.h isn't in c++ standard, only iostream is, and after that using namespace std is missing or use std::cout...
And if you write pure c++ code try using cstdlib instead of stdlib.h and start using std::string instead of char[].
And example of converting string to integer:

#include <iostream>
#include <string>
#include <sstream>
using namespace std;

int main()
{
int number;
string stringNumber;
stringstream ss;
cin >> stringNumber;
ss << stringNumber;
ss >> number;
cout << "you have typed: " << number << endl;
return 0;
}


View Tutorial



Subscribe to Tutorials

Related Tutorials

Program using concept of byte long short and int in java

Update contents of a file within a jar file

Tomcat and httpd configured in port 8080 and 80

Java File

Java String

Count number of vowels, consonants and digits in a String in Java

Reverse a number in Java

Student marks calculation program in Java

Handling Fractions in Java

Calculate gross salary in Java

Calculate average sale of the week in Java

Vector in Java - Sample Program

MultiLevel Inheritance sample in Java

Multiple Inheritance sample in Java

Java program using Method Overriding

Archived Comments

1. Hi,

Your COM port is currently in u

View Tutorial          By: Ramlak at 2008-04-14 07:29:55

2. After coming to second page again I want to go to
View Tutorial          By: Bhagi at 2012-09-23 06:25:54

3. Helps very much. Thank you.
View Tutorial          By: Uwe at 2010-08-17 12:35:44

4. plz can u give me code for key excange b/n pda &am
View Tutorial          By: visnas at 2009-05-04 20:18:32

5. i have json data like coffeename and coffee prize
View Tutorial          By: Paramatma sharan upadhyay at 2015-09-21 12:14:31

6. nice article but can more example
View Tutorial          By: sandi at 2012-10-18 13:26:10

7. can u give a gud example on command line arguments
View Tutorial          By: shravan at 2010-04-09 23:11:18

8. better if it is explained with output of the progr
View Tutorial          By: dinesh at 2013-05-05 13:57:21

9. good....
View Tutorial          By: Rini at 2013-01-08 10:44:54

10. i am new to SMS, i think i need a device too. Whic
View Tutorial          By: Usman at 2015-10-05 12:06:34