Home > Back-end >  Urgent urgent, questions about the sales management system information query, small white for bosses
Urgent urgent, questions about the sales management system information query, small white for bosses

Time:03-22

This is the topic: a company has a m a salesman (code, name, etc.), responsible for sales n products (code, name, unit price, quantity, etc.), each salesman briefing will be handed on the day of the sale of each product to write a note, note include: the salesman code, product code, product sales,
Functional requirements:
(1) entry: can enter salesman, products, and note information
(2) the query, modify and delete: can query, modify and delete) a salesman, products, note information
(3) statistics: each salesman daily, monthly sales; Statistics for each product every day, monthly sales;
(4) sorting: by the day, month sales of salesman, product sorting
(5) the data structure: structure arrays, and file


Why I recorded the salesman information, input product information, then returned to the menu to view sales information product additional error information, do not understand, ask counsel


The following is the source code

# include
# include
# include
# include


Typedef struct _Salesman
{
Int no;//salesman code
char name[20];//salesman name
} Salesman;

Typedef struct _Commdity
{
int num;//product code
Char _name [20].//product name
Int price;//product unit price
Int quantity;//product quantity
} Commdity;


Typedef struct _Note
{

Int _no;//salesman code
Int _num;//product code
Int _quantity;/sales/product
} Note;
//define a node
Typedef struct _Node
{
The Salesman Salesman;
Commdity Commdity;
Note Note;
Struct _Node * Next;
} the Node;
The Head Node *=NULL;//head node

Void menu ();//the menu function
Void (in);//input information function
Void found ();//information query function

Int main ()//main function
{
System (" color 5 f ");
Int z;
While (1)
{
menu();
The scanf (" % d ", & amp; Z);
The switch (z)
{
Case 1:
In ();//information recorded
break;

Case 2:
The found ();//information query
break;
}
}
return 0;
}
Void ()//information recorded in
{
Int z;
NewNode Node *=(*) malloc (sizeof (Node));//create a new node
NewNode - & gt; Next=NULL;
If (Head==NULL)
{
The Head=newNode;
}
The else
{
NewNode - & gt; Next=Head;
The Head=newNode;
}
Printf (" please choose you need to input options: 1. The salesman 2. Product 3. Note \ n ");
The scanf (" % d ", & amp; Z);
Printf (" please input the information \ n ");
The switch (z)
{
Case 1:

Printf (" salesman code: \ n ");
The scanf (" % d ", & amp; NewNode - & gt; Salesman. No);
Printf (" the name of the salesman: \ n ");
The scanf (" % s ", & amp; NewNode - & gt; Salesman. Name);
break;

Case 2:

Printf (" product code: \ n ");
The scanf (" % d ", & amp; NewNode - & gt; Commdity. Num);
Product name: printf (" \ n ");
The scanf (" % s ", & amp; NewNode - & gt; Commdity. _name);
Printf (" product price: \ n ");
The scanf (" % d ", & amp; NewNode - & gt; Commdity. Price);
Printf (" number of products: \ n ");
The scanf (" % d ", & amp; NewNode - & gt; Commdity. Quantity);
break;

Case 3:

Printf (" salesman code: \ n ");
The scanf (" % d ", & amp; NewNode - & gt; Note. _no);
Printf (" product code: \ n ");
The scanf (" % d ", & amp; NewNode - & gt; Note. _num);
Printf (" product sales: \ n ");
The scanf (" % d ", & amp; NewNode - & gt; Note. _quantity);
break;
}

Printf (" information recorded success! \n");
system("pause");//to prevent the splash screen
system("cls");//clear screen

}

Void found ()//information query function
{
system("cls");
Int m;
Node * p=Head;
//traverse the list
Printf (" select the information you need to query: 1. The salesman 2. Product 3. Note \ n ");
The scanf (" % d ", & amp; m);
The switch (m)
{
Case 1:
Printf (" sales information \ n ");
Printf ("=========================================\ n ");
Printf (" salesman code \ t salesman name \ n ");
while(p!=NULL)
{
Printf (" % d % s \ n ", p - & gt; Salesman. No, p - & gt; Salesman. Name);
P=p - & gt; Next;
}
break;

Case 2:
Printf (" product information \ n ");
Printf ("=========================================\ n ");
Printf (" product code product name \ \ t t products unit price, the number of product \ t \ n ");
while(p!=NULL)
{
Printf (" % d % d % d % s \ n ", p - & gt; Commdity num, p - & gt; Commdity _name, p - & gt; Commdity. Price, p - & gt; Commdity. Quantity);
P=p - & gt; Next;
}
break;

Case 3:
Printf (" note information \ n ");
Printf ("=========================================\ n ");
Printf (" salesman code \ t product code \ t products sales quantity \ n ");
while(p!=NULL)
{
Printf (" % d % d % d \ n ", p - & gt; Note. _no, p - & gt; Note. _num, p - & gt; Note. _quantity);
P=p - & gt; Next;
}
break;
system("pause");
}
}

CodePudding user response:

Structure design of the building Lord has a problem, the same node, three data can be input at the same time, on the wrong code three times, because every time into space is a new application of nodes, is not in the space of the first input,

CodePudding user response:

So what do I want to design? Don't know much about
  • Related