Home >
Back-end > Error is behind the//, type a total of only four, just don't know how to change, please everyon
Error is behind the//, type a total of only four, just don't know how to change, please everyon
Void change ()
{
[color=# FF0000] struct book * p, * head, * q=NULL;//missing '; 'before' type
System (" CLS ");//missing '; 'before' type/
Int n=1, the amount;//missing '; 'before' type
Char isbn [20]={} '\ 0', the name [20]={} '\ 0', the author [20]={} '\ 0', print [20]={} '\ 0', name1 [20]={} '\ 0', zone [15]={} '\ 0';//missing '; 'before' type/
Float price;
P=head=the read ();
The display ();
Printf (" input to modify the book title \ n ");
The scanf (" % s ", name);
While (p)
{
If (STRCMP (p - & gt; Book1. The name, the name)==0)//find books to modify, after find out of circulation
{
Q=p;
break;
}
The else
P=p - & gt; next;
}
While (n!=0)
{
Printf (" please select the information you have to be modified, exit to modify, please press 0 \ n ");
Printf (" * -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- - * \ n ");
Printf (" * 1. Modify the ISBN number 2. Modify the author information 3. Modify the press information * \ n ");
Printf (" * 4. Modify the number 5. 6. Modify the unit price to modify the title * \ n ");
Printf (" * 7. Modify the number * \ n ");
Printf (" * -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- - * \ n ");
The scanf (" % d ", & amp; n);
The switch (n)
{
Case 1: printf (" input new ISBN number: "); The scanf (" % s ", isbn); Strcpy (q - & gt; Book1. Isbn isbn); break;
Case 2: printf (" input new authors information: "); The scanf (" % s ", the author); Strcpy (q - & gt; Book1. The author, the author); break;
Case 3: printf (" input the new press information;" ); The scanf (" % s ", print); Strcpy (q - & gt; Book1. Print, print); break;
Case 4: printf (" input the new number;" ); The scanf (" % d ", & amp; Amount). Q - & gt; Book1. Amount=amount; break;
Case 5: printf (" input the new unit price;" ); The scanf (" % f ", & amp; Price); Q - & gt; Book1. Price=price; break;
Case 6: printf (" input new title: "); The scanf (" % s ", name1); Strcpy (q - & gt; Book1. Name, name1); break;
Case 7: printf (" enter a new number: "); The scanf (" % s ", zone); Strcpy (q - & gt; Book1. Zone, the zone); break;
/* default: printf (" input error, please input again! \n"); break; */
}
}
Write (head);//will be the revised information in the file
Printf (" modify success! \n");
The display ();
}
//find books
Void the find ()
{
Struct book * head=NULL, * p;
Char name [20]={} '\ 0';
Int flag=0;
Char n=1;
System (" CLS ");
The head=read ();//to the head to the incoming file data chain table
P=the head;
Printf (" input to find books related information (ISBN/book/author) (note shall not exceed 20 words) : \ n ");
The scanf (" % s ", name);//: error C2065: 'name' : undeclared identifie
While (p)
{
If (STRCMP (p - & gt; Book1. The name, the name)==0)//find books to modify, after find out of circulation/warning C4047: 'function' : 'const char *' differs in levels of indirection from 'int'//warning C4024: 'STRCMP' : the company types for formal and actual parameter 2
{
Q=p;
break;
}
The else
P=p - & gt; next;
}
While (n!=0)//c: : error C2065: 'n' : undeclared identifier
{
Printf (" please select the information you have to be modified, exit to modify, please press 0 \ n ");
Printf (" * -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- - * \ n ");
Printf (" * 1. Modify the ISBN number 2. Modify the author information 3. Modify the press information * \ n ");
Printf (" * 4. Modify the number 5. 6. Modify the unit price to modify the title * \ n ");
Printf (" * 7. Modify the number * \ n ");
Printf (" * -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- - * \ n ");
The scanf (" % d ", & amp; n);
The switch (n)
{
Case 1: printf (" input new ISBN number: "); The scanf (" % s ", isbn); Strcpy (q - & gt; Book1. Isbn isbn); break;//the error C2065: 'isbn: undeclared identifier//warning C4047:' function ':' const char * 'differs in levels of indirection from' int '
//warning C4024: 'strcpy' : the company types for formal and actual parameter 2
Case 2: printf (" input new authors information: "); The scanf (" % s ", the author); Strcpy (q - & gt; Book1. The author, the author); break;//the error C2065: 'author' : undeclared identifier
//warning C4047: 'function' : 'const char *' differs in levels of indirection from 'int'
//warning C4024: 'strcpy' : the company types for formal and actual parameter 2
Case 3: printf (" input the new press information;" ); The scanf (" % s ", print); Strcpy (q - & gt; Book1. Print, print); break;//the error C2065: 'print' : undeclared identifier
//warning C4047: 'function' : 'const char *' differs in levels of indirection from 'int'
//warning C4024: 'strcpy' : the company types for formal and actual parameter 2
Case 4: printf (" input the new number;" ); The scanf (" % d ", & amp; Amount). Q - & gt; Book1. Amount=amount; break;//'amount' : undeclared identifier
//warning C4047: 'function' : 'const char *' differs in levels of indirection from 'int'
//warning C4024: 'strcpy' : the company types for formal and actual parameter 2
Case 5: printf (" input the new unit price;" ); The scanf (" % f ", & amp; Price); Q - & gt; Book1. Price=price; break;//the error C2065: 'price: undeclared identifier
Case 6: printf (" input new title: "); The scanf (" % s ", name1); Strcpy (q - & gt; Book1. Name, name1); break;//the error C2065: 'name1' : undeclared identifier
//warning C4024: 'strcpy' : the company types for formal and actual parameter 2
//warning C4024: 'strcpy' : the company types for formal and actual parameter 2
Case 7: printf (" enter a new number: "); The scanf (" % s ", zone); Strcpy (q - & gt; Book1. Zone, the zone); break;//the error C2065: 'zone' : undeclared identifier
//warning C4024: 'strcpy' : the company types for formal and actual parameter 2
//warning C4024: 'strcpy' : the company types for formal and actual parameter 2
nullnullnullnullnullnullnullnullnullnullnullnullnull