You are here:

C++/functions

Advertisement


Question
Hi
I want to know the program of some special functions in c++.please guide me to find the
commands of functions that used in c++ programming.I need the text of these functions: "atoi","itoa","ftoa","atof".

Answer
I give you one of them; You should be able to do the rest, yourself. I you still have problems; you may contact XtoY@shabah.net

int atoi(const char *nptr){
       int c;
       long total;
       int sign;
       while ( isspace((int)(unsigned char)*nptr) )
         ++nptr;
       c = (int)(unsigned char)*nptr++;
       sign = c;
       if (c == '-' || c == '+')
         c = (int)(unsigned char)*nptr++;
       total = 0;
       while (isdigit(c)) {
         total = 10 * total + (c - '0');
         c = (int)(unsigned char)*nptr++;
       }
       if (sign == '-')
         return -total;
       else
         return total;
}

C++

All Answers


Answers by Expert:


Ask Experts

Volunteer


Sam

Expertise

You may ask me about simple to complicated C/C++ programming methods/style and most like questions about network programming in C++.

Experience

I'm a professional programer in C++ and network/internet programming.

©2016 About.com. All rights reserved.