Function: itoa (a, B, 10 );
Function: place the 10-digit value of a in string B;
C ++ code
# Include <iostream>
Using namespace std;
Int main ()
{
Char str [11];
Int I;
Cin> I;
Itoa (I, str, 10 );
Cout <str <endl;
Return 0;
}
# Include <iostream>
Using namespace std;
Int main ()
{
Char str [11];
Int I;
Cin> I;
Itoa (I, str, 10 );
Cout <str <endl;
Return 0;
}
Note: not all compilers are available!
Function: atoi (str );
Function: converts str to an integer and returns the C ++ code.
# Include <iostream>
Using namespace std;
Int main ()
{
Char str [11];
Int I;
Cin> str;
I = atoi (str );
Cout <I <endl;
Return 0;
}
# Include <iostream>
Using namespace std;
Int main ()
{
Char str [11];
Int I;
Cin> str;
I = atoi (str );
Cout <I <endl;
Return 0;
}
Note: although this function is a bit like itoa, it is worth noting that atoi has a return value. itoa only executes commands.
Others
C ++ code
Function isalpha (char) determines whether it is a letter
Function isdigit (char) to determine whether it is a number
The isalnum (char) function determines whether it is a number or letter.
The preceding three functions are in the header file ctype. h.
The strupr (char * s) function converts lowercase letters in string s to uppercase letters.
The strlwr (char * s) function converts uppercase letters in string s to lowercase letters.
Function strrev (char * s) reverses the order of all characters in string s (excluding NULL characters)
Function toupper, tolower case-sensitive Conversion
Function floor: int m = floor (sqrt (x) + 0.5) floating point error correction