L
lht123
Unregistered / Unconfirmed
GUEST, unregistred user!
代码如下
#include <iostream.h>
class Node {
public:
double data
Node * next;
}
void CreatLinklist(){
Node *hNode=new Node
hNode->data=0;
hNode->next=NULL;
cout<<"the headnode address is "<<hNode<<endl;
cout<<"the headnode.data is "<<hNode->data<<endl;
cout<<"the headnode->next is "<<hNode->next<<endl;
cout<<endl;
Node* inlinkNode[5];
int j;
cout<<"input the linklist node number :"<<" ";
cin>>j;
cout<<endl;
for(int i=1
i<j
i++){
inlinkNode=new Node;
inlinkNode->data=i;
inlinkNode->next=inlinkNode[i-1];
if (i==1 )
inlinkNode->next=hNode;
cout<<"the inlinkNode["<<i-1<<"] address is "<< inlinkNode[i-1]<<endl;
cout<<"the inlinkNode["<<i<<"]->data is " <<inlinkNode->data<<endl;
cout<<"the inlinkNode["<<i<<"]->next is "<<inlinkNode->next<<endl;
cout<<endl;
}
}
void main()
{
CreatLinklist();
}
这是 提示错误 “0x02632638”指令引用的“0x00000014”内存,该内存不能“writen”
#include <iostream.h>
class Node {
public:
double data
Node * next;
}
void CreatLinklist(){
Node *hNode=new Node
hNode->data=0;
hNode->next=NULL;
cout<<"the headnode address is "<<hNode<<endl;
cout<<"the headnode.data is "<<hNode->data<<endl;
cout<<"the headnode->next is "<<hNode->next<<endl;
cout<<endl;
Node* inlinkNode[5];
int j;
cout<<"input the linklist node number :"<<" ";
cin>>j;
cout<<endl;
for(int i=1
i<j
i++){
inlinkNode=new Node;
inlinkNode->data=i;
inlinkNode->next=inlinkNode[i-1];
if (i==1 )
inlinkNode->next=hNode;
cout<<"the inlinkNode["<<i-1<<"] address is "<< inlinkNode[i-1]<<endl;
cout<<"the inlinkNode["<<i<<"]->data is " <<inlinkNode->data<<endl;
cout<<"the inlinkNode["<<i<<"]->next is "<<inlinkNode->next<<endl;
cout<<endl;
}
}
void main()
{
CreatLinklist();
}
这是 提示错误 “0x02632638”指令引用的“0x00000014”内存,该内存不能“writen”