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. super......... thanks 4 ur great example...
View Tutorial          By: jithinraj at 2013-03-13 08:34:07

2. very nice
View Tutorial          By: prasad at 2009-11-11 05:03:16

3. but include<iostream> is main function.
View Tutorial          By: glen at 2009-02-03 22:19:22

4. Very usefull tutorial, but I've got a question:
View Tutorial          By: Wolfgang Marcos at 2011-05-16 11:12:19

5. Got follwoing error.


javax.

View Tutorial          By: Amit Sinha at 2013-11-26 08:35:00

6. hello it wrong in memmove nd memcpy case. I am get
View Tutorial          By: jaya at 2012-04-05 17:18:14

7. What happens if applied to an integer array?
View Tutorial          By: SHUVO at 2015-07-01 21:14:16

8. import java.util.*;

class Pstring<

View Tutorial          By: Bhaskar.pg at 2014-05-29 12:39:52

9. By running ListPorts, I am not getting any output
View Tutorial          By: Srinivasa Rao at 2009-04-02 05:17:20

10. Hi all,
I'm getting this error on running

View Tutorial          By: shreya.g at 2008-06-23 00:13:52