Home > Back-end >  C why I build list, according to the textbook play above, failure generating solutions, display cann
C why I build list, according to the textbook play above, failure generating solutions, display cann

Time:10-10

#include
#include
#include
using namespace std;
The template & lt; Typename DataType>
Struct Node
{
DataType data;
Struct Node * next;

};
The template & lt; Typename DataType>
The class LinkList
{
Public:
LinkList ();
Bool If_Empty ();
Void PrintList ();
Int Length ();
DataType Find_Value_By_Pos (int pos);
Int Find_Pos_By_Value DataType (value);
Private:
Node * first;
Node * PTR.
};
The template & lt; Typename DataType>
LinkList : : LinkList () {
The first=new Node;
First - & gt; Next=nullptr;
}
The template & lt; Typename DataType>
Bool LinkList : : If_Empty () {
If (first - & gt; Next==nullptr)
{
return 1;
}
The else
{
return 0;
}
}
The template & lt; Typename DataType>
Void LinkList : : PrintList () {
Node * PTR=first - & gt; Next;
While (PTR!=nullptr)
{
Cout & lt; }
Cout & lt; }
The template & lt; Typename DataType>
Int LinkList : : Length () {
The Node * p=first - & gt; Next;
int count=0;
While (p!=nullptr)
{
count++;
}
return count;
}
The template & lt; Typename DataType>
DataType LinkList : : Find_Value_By_Pos (int pos) {
Node * p=first - & gt; Next;
int count=1;
While (p!=nullptr& & Count{
P=p - & gt; Next;
count++;
}
If (p==nullptr)
{
Throw "find position error";
}
The else
{
The return p - & gt; The data;
}
}
The template & lt; Typename DataType>
Int LinkList : : Find_Pos_By_Value (DataType value) {
Node * p=first - & gt; Next;
int count=1;
While (p!=nullptr)
{
If (p - & gt; data=https://bbs.csdn.net/topics/=value)
{
return count;
}
count++;
P=p - & gt; Next;
}
return 0;
}

CodePudding user response:

The main function of you?

CodePudding user response:

And the main function it doesn't matter, I just point the generation of the solution, not to start the debugger

CodePudding user response:

Feeling is this file is not included in the project, compile this file alone could not find calls its main function

CodePudding user response:

I tried it on
In the back with
Int main ()
{
return 0;
}
There is no error

CodePudding user response:

Ha ha ha ha yes yes added int main, ha ha ha I want to be your stupid cry ha ha ha ha
  • Related