键盘输入head1之后,通过按Ctrl+z停止输入,但也无法进入head2的cin输入了。
程序需要如果改?谢谢。#include
#include
using namespace std;
template
class Node
{
public:
Node *prev, *next;
T value;
Node():prev(this),next(this){}
Node(T x):prev(NULL),next(NULL),value(x){}
Node(T x, Node *p, Node *n):prev(p),next(n),value(x){}
};
template
int calcLength(Node* head)
{
int nLen=0;
Node *p=head->next;
while(p!=head)
{
nLen++;
p=p->next;
}
return nLen;
}
int main()
{
int tmp;
cout << "input link1:" << endl;
Node *head1 = new Node();
Node *p=head1;
while (cin >> tmp)
{
N