Home > Back-end >  Could you tell me the local function definitions are what is illegal
Could you tell me the local function definitions are what is illegal

Time:10-20

#include
#include
Typedef struct node
{int data;//card number
Int count;//record the number of double card
Struct node * next;//pointer to the next node
} LinkList;

LinkList * create (int k)//create the list function
{LinkList * head, * p, * q;
int i=0;
Head=(LinkList *) malloc (sizeof (LinkList));//the application head node space
P=the head;//pointer pointing to the first node p
Q=(LinkList *) malloc (sizeof (LinkList));//the node space applications
While (i{q - & gt; data=https://bbs.csdn.net/topics/i+1;//for each node of the data assignment
Q - & gt; Count=0;//to the count of each node assignment
P - & gt; Next=q; After the link to the p//q
P=q;//q as new p
Q=q - & gt; Next;//q pointer back
Q=(LinkList *) malloc (sizeof (LinkList)); i++; }
P - & gt; Next=NULL;//will be the last node of the next domain assigned to an empty
Return (the head); }

LinkList * overcard (LinkList * head, int k)//flip function
{LinkList * p;
For (int I=2; i<=k; I++)
{p=head - & gt; Next;//p points to the first element nodes?
while(p!=NULL)
{if ((p - & gt; Data) % I==0)//if the number of CARDS, can be divided exactly by base I makes
P - & gt; count++;
P=p - & gt; Next; }//p pointer back}
Return (the head); }
Int the result (s)//output function
{Linklist * q;
Q=head - & gt; Next;//q point to the first element node
Printf (" face up card number is: ");
While (q!=NULL)
{if ((q - & gt; The count) % 2==0)//a number is even if turned face up, output
Printf (" % 4 d ", q - & gt; The data);
Q=q - & gt; Next; }
printf("\n"); }

Void main ()
{char ch;
K=52;//a total of 52 CARDS
LinkList * head, * p;
Printf (" this program (Y), does not perform this procedure (Q) \ n ");
The scanf (" % c ", & amp; Ch);
While (1)
{if (ch=='Y')
{the head=creat (k);
P=overcard (head, k);
The result (p); }
Else if (ch=='Q')
{printf (" exit the program! \n"); break; }
The scanf (" % c ", & amp; Ch); }
}

-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- the Configuration: oo - Win32 Debug -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Compiling...
Oo. CPP
C: \ Program Files \ Visual C + + (x86) \ Bin \ oo CPP (35) : error C2601: 'the result: the local function definitions are illegal
C: \ Program Files \ Visual C + + (x86) \ Bin \ oo CPP (45) : error C2601: 'main' : the local function definitions are illegal
Error executing cl. Exe.

Oo. Exe - 2 error (s), and 0 warning (s)

  • Related