#include <iostream>using namespace std;void main(){ int N; cout << "请输入一个正整数N:"; cin >> N; char *a = new char[N+1]; for (int i = 0; i < N; ++i) a[i] = i+48; a[N] = '\0'; cout << a << endl;}
#include <iostream>using namespace std;void main(){int N;cout<<"请输入一个正整数N:";cin>>N;cout<<"\n";char *a=new char[N+1];int k=0;for (int i=0; i<N; i++) a[k++] = i+0x30; a[k] = '\0';cout<<a<<endl;}
#include <iostream>using namespace std;void main(){ int N; printf("请输入一个正整数N:"); scanf("%d",&N); char *a = new char[N+1]; for (int i = 0; i < N; ++i) a[i] = i+48; a[N] = '\0'; cout << a << endl;}