| # | Problem | Pass Rate (passed user / total user) |
|---|---|---|
| 12576 | decreasing linked list |
|
| 12577 | Bank Data |
|
Description
Given a link list structure named Node.
typedef struct _Node {
int data;
struct _Node *next;
} Node;
Use this structure to implement a decreasing integer link list.
You will be provided with main.c and function.h, and asked to implement function.c.
For OJ submission:
Step 1. Submit only your function.c into the submission block. (Please choose c compiler)
Step 2. Check the results and debug your program if necessary.
main.c
Input
A non negative integer data per rows, if input is smaller then 0 then exit the while loop and exit the program.
(note that : the number of input integer data will not exceed 13000)
Output
Please follow the output of program
Sample Input Download
Sample Output Download
Partial Judge Code
12576.cPartial Judge Header
12576.hTags
Discuss
Description
One day, you are be assigned a task to write the program for bank. In this task, you are required to write two function below:
func1 : AccountData* createData(char* name, int money);
func2 : AccountData* userQuery(AccountData* data);
func1 help bank to store user's data and func2 help bank to return a copy data to user (In order to avoid user directly modify the money information in bank)
The bank give you a simple data struct to implement above two function.
typedef struct _AccountData {
char* name;
int money;
} AccountData;
main.c
function.h
note that: you can use strlen(const char* str) in string.h to get the length of string
hint: you should not directly assign name to data->name, you need to malloc some memory space to copy the name's value.
data->name = name (x)
Input
S N M
S: the username (2 < length(username) < 100)
N: the money in the bank
M: the number which user try to modify.
Output
Output the current money in the bank and other information. (if user try to modify the money in bank then output warning information otherwise output "query finish")