C What does this paragraph mean, just note the notes of each paragraph, thank you

Updated on technology 2024-02-09
4 answers
  1. Anonymous users2024-02-05

    lnode: the name of the defined structure.

    lnode: the alias of the structure lnode.

    LinkList is also an alias for lnode, which is just a pointer to a structure that :linklist.

    int data;A member is defined within the structure.

    struct lnode *next;A pointer to the structure.

    But I think you might be typosing the wrong one, the source program should be:

    typedef struct lnode

    int data;

    struct lnode *next;

    lnode *linklist;

    There is no comma in the last line. In this case, lnode is an alias for the structure lnode, and *linklist is a pointer defined by that alias.

  2. Anonymous users2024-02-04

    A structure is defined: lnode

    There are two variables in the structure: an int type data; The other is a pointer of type lnode next.

    Such a structure is obviously intended for use in linked lists, and it is a linked list for demonstration, and the actual linked list is often much more complex than this.

    This classmate, I still suggest you read more books, this is the most basic and basic knowledge, don't understand this, it's like not knowing 1+1=2, so how do you learn mathematics?

    Other: The last line is with a comma, and the original intention of the program is to define two types of variables: one is the structure type lnode, and the other is the pointer type linklist, which is really downstairs.

  3. Anonymous users2024-02-03

    ypedef struct lnode "Define a data structure lnode

    int data; "define an integer datastruct lnode *next; "a node lnode, *linklist;

  4. Anonymous users2024-02-02

    Recursive thinking is appropriate for situations where a problem can be broken down into multiple sub-problems. In the Tower of Hanoi problem, each subproblem can be seen as a smaller Tower of Hanoi problem and can therefore be solved using recursive thinking.

    This problem can be broken down into three steps:

    Start by moving n-1 pieces from A through C to B (with the help of column C).

    Move the remaining piece of A to C directly.

    Finally, the n-1 pieces on B are moved to C via A (with the help of column A).

    Each time you move, you need to call a move() function to record the number of moves and print the move.

    When the number of pieces is 1, the problem has been solved, and you can move it directly.

    When the number of chess pieces is greater than 1, the problem can be decomposed into multiple sub-problems and solved according to the recursive idea.

    The boundary condition for recursive solving is to move the pieces directly from A to C when the number of pieces is 1.

    Here are the detailed notes of **

    #include

    using namespace std;

    int i=0;Define the global variable i, which is used for counting.

    void move(char start,char end) defines the function move, which is used to print the move process.

    i=i+1;Each time the move function is called, i increments by 1

    void hannuota(int n,char a,char b,char c) defines the function hannuota, which is used to recursively solve the hannuota problem.

    if(n==1) moves it directly from A to C when there is only one piece

    move(a,c);Call the move function to print the move process.

    else When the number of pieces is not 1, it is solved recursively.

    hannuota(n-1,a,c,b);Start by moving n-1 pieces from A to B via C

    move(a,c);Then move the bottom piece from A to C

    hannuota(n-1,b,a,c);Finally, move the n-1 piece from B through A to C

    int main()

    int m;Defines the variable m, which is used to store the number of pieces.

    cout<<"Enter the number of pieces:";

    cin>>m;Enter the number of pieces from the console.

    hannuota(m,'a','b','c');Call the hannuota function to solve the Tower of Hanoi problem.

    cout<<"A total of needs to be moved"

Related questions
3 answers2024-02-09

3c=three corridors.It is an RPG of War3 and is popular with the majority of War3 players. Especially the welcome of the students on the university campus. >>>More

14 answers2024-02-09

Similar to what we now call origin.

4 answers2024-02-09

The so-called reliance, that is"Grass"of the spoken language. I suggest that LZ don't talk about this! @!It's very uncivilized!

9 answers2024-02-09

It's Edison Chen, CGX is the initials of his name.

Now his business is so hot, everyone is just shorthand like this for the convenience of typing. >>>More

15 answers2024-02-09

Recorded? Haven't heard of it. It should be Lide!