Home > Back-end >  Urgent please!!!!!! C class encountered a small problem
Urgent please!!!!!! C class encountered a small problem

Time:09-16

's course requirement is to define a List header files, and students and access information stored in the List, then I will use a linked List and node, the students have a requirement information sorted by students' overall performance and output
If the code


In order to facilitate debugging, I first define a setfirst function information input in advance a few students in the main function, convenient debugging sort function
Then in this sort output function (outputinfo), originally wanted to use bubble sort method and the output, but always run out


Trouble, have a look at why such mistakes how to change information to ascending output with overall grades students!!!!!! Is a matter of class set!!!!! Very urgent!!!!! Trouble you more correct!!!!! Thank you humble small white online
Outinfo function code

Void outputinfo ()
{
Node * p;
Node * q;
The Node temp.//intermediate variable
For (p=head - & gt; next; P - & gt; Next!=NULL; P=p - & gt; Next)
{
For (q=p - & gt; next; Q!=NULL; Q=q - & gt; Next)
{
If (p - & gt; The info - & gt; The summary & lt; Q - & gt; The info - & gt; The summary)
{
Temp. Info=p - & gt; The info.
P - & gt; Info=q - & gt; The info.
Q - & gt; Info=temp. The info;
}
}
}
Node * s=head;
for (int i=0; i {
S=s - & gt; next;
Cout & lt; <"Name:" & lt; Cout & lt; <"Overall performance:" & lt; }
}
};
Thank you again for a minute!!!!!!

CodePudding user response:

0 XCDCDCD said there was no initialization, i.e., the memory is not assigned space

CodePudding user response:

reference 1/f, Simple, Soft reply:
0 XCDCDCD said there was no initialization, namely the memory is not assigned space

Problem has been solved, thank you very much
  • Related