Home > Back-end >  VS appeared when why code storage, unable to read from memory, strives for the great god save
VS appeared when why code storage, unable to read from memory, strives for the great god save

Time:09-23

#include
#include
using namespace std;
Struct Dancer
{
int num; No.//dancers
String name;//name
int age;//age
String sex;//gender
Int height;//height
Int weight;//weight
The string type.//dance type
};
Struct Node
{
Dancer data;
Struct Node * next;
};
The class DancerList
{
Public:
DancerList ()
{
First Node *=new Node;
First - & gt; Next=NULL;
}
~ DancerList ()
{
The Node * p, * q;
P=first;
While (p)
{
Q=p;
P=p - & gt; Next;
The delete q;
}
}
Void the Insert ()//add
{
Node * z;
Z=new Node;
Cout & lt; <"Num:";
Cin & gt;> Z - & gt; Data. The num;
Cout & lt; <"Name:";
Cin & gt;> Z - & gt; Data. The name;
Cout & lt; <"Sex";
Cin & gt;> Z - & gt; Data. The sex;
Cout & lt; <"The age:";
Cin & gt;> Z - & gt; Data. The age;
Cout & lt; <"Height:";
Cin & gt;> Z - & gt; Data. The height;
Cout & lt; <"Weight:";
Cin & gt;> Z - & gt; Data. The weight;
Cout & lt; <"Type:";
Cin & gt;> Z - & gt; Data. The type;
Z - & gt; Next=first - & gt; Next;
First - & gt; Next=z;
}
Void the Delete (int num)
{
The Node * p, * q;
Q=first;
P=q - & gt; Next;
While (p)
{
If (p - & gt; Data. The num==num)
break;
Q=p;
P=p - & gt; Next;
}
If (p==NULL)
Cout & lt; <"Error" num & lt; The else
{
Q - & gt; Next=p - & gt; Next;
The delete p;
}
}

Void the Modify (int num)
{
The Node * p, * q;
Q=first;
P=q - & gt; Next;
While (p)
{
If (p - & gt; Data. The num==num)
break;
Q=p;
P=p - & gt; Next;
}
If (p==NULL)
Cout & lt; <"Error" num & lt; The else
{
Cout & lt; <"Change.";
Cout & lt; <"Num:";
Cin & gt;> P - & gt; Data. The num;
Cout & lt; <"Name:";
Cin & gt;> P - & gt; Data. The name;
Cout & lt; <"Sex";
Cin & gt;> P - & gt; Data. The sex;
Cout & lt; <"The age:";
Cin & gt;> P - & gt; Data. The age;
Cout & lt; <"Height:";
Cin & gt;> P - & gt; Data. The height;
Cout & lt; <"Weight:";
Cin & gt;> P - & gt; Data. The weight;
Cout & lt; <"Type:";
Cin & gt;> P - & gt; Data. The type;
Cout & lt; <"Success" & lt; }
}
Node * Search (int num)
{
Node * p;
P=first - & gt; Next;
While (p)
{
If (p - & gt; Data. The num==num)
break;
P=p - & gt; Next;
}
return p;
}

Int the Count ()
{
int count=0;
Node * p;
P=first - & gt; Next;
While (p)
{
count++;
P=p - & gt; Next;
}
Cout & lt; <"Number has been input dancers: :" & lt; Return the count.
}
Void the output ()
{
Cout & lt; <"Number" & lt; <'\ t' & lt; <"Name" & lt; <'\ t' & lt; <"Gender" & lt; <'\ t' & lt; <"Age" & lt; <'\ t' & lt; <"Height" & lt; <'\ t' & lt; <"Weight" & lt; <'\ t' & lt; <"Dance" & lt; Struct Node * p;
P=first - & gt; Next;
While (p)
{
Cout & lt;

Cout & lt;

P=p - & gt; Next;
}
}

Private:
Node * first;
};
# include "dancer1. H"
#include
#include
using namespace std;

Int main ()
{
DancerList d;
Int choice=1;
Int n=0;
Int k=0;
Int t=0;
Node * p;
While (choice!=8)
{
Cout<& lt;" * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * "& lt; Cout<& lt;" * * "& lt; Cout<& lt;" * 1. Insert * "& lt; Cout<& lt;" * 2. Delete * "& lt; Cout<& lt;" * 3. The Modify * "& lt; Cout<& lt;" * 4. The Search * "& lt; Cout<& lt;" * 5. Count * "& lt; Cout<& lt;" * 6. The Output * "& lt; Cout<& lt;" * 7. Sort * "& lt; Cout<& lt;" * 8. Exit * "& lt; Cout<& lt;" * * "& lt; Cout<& lt;" * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * "& lt; CoutCout<& lt;" Both please input choice: ";
cin> Choice;
The switch (choice)
{
Case 1:
D.I nsert ();
break;
Case 2:
Cout<& lt;" Please input dancers to delete information number: "& lt; cin> n;
D.D elete (n);
break;
Case 3:
Cout<& lt;" Please input dancers to modify information number: "& lt; cin> k;
D.M odify (k);
break;
Case 4:
Cout

  • Related