#include <iostream>
#include <stdio.h>
#include <climits>
using namespace std;
void Int2Char( char * Result, unsigned int ToConvert)
{
uchar Digit[ 5 ] ;
int c;
unsigned int H1,H2;
H1= ToConvert;
H2= 10000 ; // Needed because PinguinoC lacks pow function.
for ( c= 4 ; c> 0 ; c-- )
{
Digit[ c] = H1/ H2;
H1 % = H2; // use of modulo operator or H1 = H1 - Digit[c]*H2
H2= H2/ 10 ;
Result[ 4 - c] = Digit[ c] + 48 ;
}
Result[ 4 ] = H1+ 48 ;
}
int main( ) {
char Decimal[ 5 ] ; // This array of char will hold the endresult of Int2Char
unsigned int Test; // This will hold the int you want to be converted
Test= 4294966696 ;
Int2Char( Decimal,4294966696 ) ;
return 0 ;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8c3RkaW8uaD4KI2luY2x1ZGUgPGNsaW1pdHM+CnVzaW5nIG5hbWVzcGFjZSBzdGQ7Cgp2b2lkIEludDJDaGFyKGNoYXIgKlJlc3VsdCwgdW5zaWduZWQgaW50IFRvQ29udmVydCkKeyAgCiAgdWNoYXIgRGlnaXRbNV07CiAgaW50IGM7CiAgdW5zaWduZWQgaW50IEgxLEgyOwogCiAgSDE9VG9Db252ZXJ0OwogIEgyPTEwMDAwOwkgICAgICAgICAgICAgICAgICAgICAgICAvLyBOZWVkZWQgYmVjYXVzZSBQaW5ndWlub0MgbGFja3MgcG93IGZ1bmN0aW9uLgogCiAgZm9yIChjPTQ7Yz4wO2MtLSkKICB7CiAgICBEaWdpdFtjXSA9IEgxL0gyOwogICAgSDEgJT1IMjsgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyB1c2Ugb2YgbW9kdWxvIG9wZXJhdG9yIG9yIEgxID0gSDEgLSBEaWdpdFtjXSpIMgogICAgSDI9SDIvMTA7CiAgICBSZXN1bHRbNC1jXT1EaWdpdFtjXSs0ODsKICB9CiAgUmVzdWx0WzRdPUgxKzQ4Owp9CgoKaW50IG1haW4oKSB7CiAgY2hhciBEZWNpbWFsWzVdOyAgICAgICAgICAgICAgICAvLyBUaGlzIGFycmF5IG9mIGNoYXIgd2lsbCBob2xkIHRoZSBlbmRyZXN1bHQgb2YgSW50MkNoYXIgICAJCQkgCiAgdW5zaWduZWQgaW50IFRlc3Q7ICAgICAgICAgICAgICAvLyBUaGlzIHdpbGwgaG9sZCB0aGUgaW50IHlvdSB3YW50IHRvIGJlIGNvbnZlcnRlZAogCiAgVGVzdD00Mjk0OTY2Njk2OwogIEludDJDaGFyKERlY2ltYWwsNDI5NDk2NjY5Nik7CglyZXR1cm4gMDsKfQ==
compilation info
prog.cpp:30:3: warning: this decimal constant is unsigned only in ISO C90
Test=4294966696;
^
prog.cpp:31:3: warning: this decimal constant is unsigned only in ISO C90
Int2Char(Decimal,4294966696);
^
prog.cpp: In function 'void Int2Char(char*, unsigned int)':
prog.cpp:8:3: error: 'uchar' was not declared in this scope
uchar Digit[5];
^
prog.cpp:17:5: error: 'Digit' was not declared in this scope
Digit[c] = H1/H2;
^
stdout