Différences entre les versions de « Langage C++/Méthodes »

ajout d'informations
m (Autoformatage, retrait de la clé de tri)
(ajout d'informations)
{{Exemple
| contenu =
<source lang="cpp">
#include <stdio.h>
 
void mToString(char* pString, int pValue)
{
sprintf(pString, "%i", pValue);
}
 
void mToString(char* pString, unsigned int pValue)
{
sprintf(pString, "%u", pValue);
}
 
void mToString(char* pString, long pValue)
{
sprintf(pString, "%ld", pValue);
}
 
void mToString(char* pString, unsigned long pValue)
{
sprintf(pString, "%lu", pValue);
}
 
int main(int pArgumentsCount, char* pArgumentsValues[])
{
int vInteger = -1123456789;
unsigned int vUnsignedInteger = 3123456789;
long vLong = -1123456789;
unsigned long vUnsignedLong = 3123456789;
 
char* vString = new char[15];
 
mToString(vString, vInteger);
printf(vString);
mToString(vString, vUnsignedInteger);
printf(vString);
mToString(vString, vLong);
printf(vString);
mToString(vString, vUnsignedLong);
printf(vString);
 
delete [] vString;
return 0;
}
 
</source>
1 049

modifications