#include < iostream.h >
#include < math.h >
int CountItg( int ) ;
bool Con2String( int , char * , int ) ;
void main()
{
char s[80] ;
int itg = 1 , i = 0 , nCount = 0 ;
while( itg != 0 )
{
cout << "/ninput '0' can out of circle" << endl ;
cout << " /nplease input the integer: " ;
cin >> itg ;
nCount = CountItg( itg ) ;
if( Con2String( itg , s , nCount ) )
cout << s << endl ;
}
}
int CountItg( int input )
{
int n = 0 ;
if ( input > 65535 ) return 0 ;
while( input / 10 != 0 )
{
if( n > 5 ) break ;
n ++ ;
input = input / 10 ;
}
return n + 1 ;
}
bool Con2String( int input , char *s , int nCount )
{
if( nCount == 0 )
{
cout << "please input the illegle data" << endl ;
return false ;
}
int ntc = nCount ;
int nti = input ;
int i = 0 ;
char tc ;
s[ nCount ] = '/0' ; //add end flag at the end of the string
while( nCount-- != 0 )
{
int nt = nti % 10 ;
tc = nt + 48 ;
s[ nCount ] = tc ;
nti = nti / 10 ;
cout << "in function Con2String" << endl ;
}
return true ;
}