#include<iostream>
using namespace std;
void intToChar(int n);
void main()
{
int n;
cout << "请输入一个整数" << endl;
cin >> n;
cout << "整数" << n << "转换为字符" << endl;
if (n < 0)
{
n = -n;
cout << '-' << endl;
}
intToChar(n);
}
void intToChar(int n)
{
int c;
char ch;
c = n % 10;
ch = c + '0';
if (n / 10 != 0)
intToChar(n / 10);
cout << ch << " ";
}
using namespace std;
void intToChar(int n);
void main()
{
int n;
cout << "请输入一个整数" << endl;
cin >> n;
cout << "整数" << n << "转换为字符" << endl;
if (n < 0)
{
n = -n;
cout << '-' << endl;
}
intToChar(n);
}
void intToChar(int n)
{
int c;
char ch;
c = n % 10;
ch = c + '0';
if (n / 10 != 0)
intToChar(n / 10);
cout << ch << " ";
}