//采用单链表,将超长整数的各位上的书分解到一个动态生成的单向链表中。
#include <iostream>
using namespace std;
int const n=200;
struct LinkNode{
short int data;
LinkNode *next;
};
int main(){
char num[n];
cout<<"请输入一个超长整数:"<<endl;
cin>>num;//num的位数一定要达到规定的n数,否则输出的时候会出错
int i=0;
LinkNode *head,*tail,*temp;
head=new LinkNode;
if (head==NULL)return NULL;
else{
head->data=num[i]-'0';
head->next=NULL;
tail=head;
i++;
}
while (i<n)
{
temp=new LinkNode;
temp->data=num[i]-'0';
temp->next=NULL;
tail->next=temp;
tail=temp;
i++;
}
while(head){
cout<<head->data;
head=head->next;
}
cout<<endl;
return 0;
}