17070047 / 17070047/CodeStructureCourse

李晋森

未關閉
#69 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視
主要語言
C++
星號
16
分支
2
PR 合併指標
30 天內沒有已合併 PR

描述

```c
#include
#include
#include
#define MAXSIZE 100
typedef struct {
int cardNum;
char name[8];
char major[10];
int classNum;
}libCardInfo;
typedef struct{
libCardInfo cardInfo;
}recordInfo;
typedef struct{
recordInfo r[MAXSIZE + 1];
int length;
}table;
void input(table *tab)
{
char s = 'Y';
tab->length = 1;
while (s == 'Y' || s == 'y'&&tab->length <= MAXSIZE){
printf("\n请输入借书证卡号:");
scanf("%d", &tab->r[tab->length].cardInfo.cardNum);
printf("请输入持卡人姓名:");
scanf("%s", tab->r[tab->length].cardInfo.name);
printf("请输入持卡人专业:");
scanf("%s", tab->r[tab->length].cardInfo.major);
printf("请输入持卡人班号:");
scanf("%d", &tab->r[tab->length].cardInfo.classNum);
printf("请问是否继续录入?(Y/N):");
getchar();
scanf("%c", &s);
tab->length++;
}
}
void output(libCardInfo *info)
{
printf("\t 借书证卡号:%d\n", info->cardNum);
printf("\t 持卡人姓名:%s\n", info->name);
printf("\t 持卡人专业:%s\n", info->major);
printf("\t 持卡人班号:%d\n", info->classNum);
printf("\n");
}
void shellinsertsort(table *tab){
int i, j, d;
d = tab->length / 2;
while (d >= 1){
for (i = d + 1; ilength; i++)
{
tab->r[0] = tab->r[i];
j = i - d;
while (j>0 && tab->r[0].cardInfo.cardNumr[j].cardInfo.cardNum)
{
tab->r[j + d] = tab->r[j];
j = j - d;
}
tab->r[j + d] = tab->r[0];
}
d = d / 2;
}
for (i = 1; ilength; i++)
{
output(&tab->r[i].cardInfo);
}
}
void seqSearch(table *tab){
int i = 1, j = 1;
char major[10];
printf("\n请输入你要查找的专业:");
scanf("%s", major);
while (ilength){
if (!strcmp(tab->r[i].cardInfo.major, major)){
output(&(tab->r[i].cardInfo));
j = 0;
}
i++;
}
if (j) printf("\t\t 『没有该专业的记录!』\n");
}
int main() {
int x, set = 1;
table tab;
while (set){
printf("\t\t 欢迎使用借书证管理系统\n");
printf("\t\t 1.录入借书证基本信息 \n");
printf("\t\t 2.输出已有借书证信息 \n");
printf("\t\t 3.专业查找借书证信息 \n");
printf("\t\t 4.退出借书证管理系统 \n");
printf("请按你的需求选择操作:");
scanf("%d", &x);
switch (x)
{
case 1:input(&tab); break;
case 2:shellinsertsort(&tab); break;
case 3:seqSearch(&tab); break;
case 4:set = 0; printf("\t\t\t『系统退出成功!』\n"); break;
default: printf("没有该选项对应的操作!");
}
system("pause");
system("cls");

}
return 0;
}
```
![qw jh5 xkvpwypkaha r](https://user-images.githubusercontent.com/45328208/49652055-e67a0080-fa6b-11e8-8862-c35a9b06fac7.png)

![iw9shivw8c _ee8h ghju3k](https://user-images.githubusercontent.com/45328208/49651849-4b812680-fa6b-11e8-979d-c214b39ba131.png)
![ft6ys6rnkc2v u5uhk3w6](https://user-images.githubusercontent.com/45328208/49651851-4c19bd00-fa6b-11e8-8c80-023e606021ff.png)

貢獻指南

這個儲存庫沒有索引到貢獻指南

研究方向

The issue contains a full C program for a library card management system with screenshots, but no description of what needs to be changed or fixed. Start by understanding the program's structure in the provided code, compile and run it to see its behavior. Look for any logical errors, memory issues, or improvements suggested by the screenshots. Determine what 'done' looks like by identifying the specific bug or enhancement required.

由索引模型根據 Issue 內容生成。

評估

技術堆疊
c
領域
cli
Issue 類型
缺陷
難度
3/5
預估耗時
1-2 天
活躍度
停滯
描述清晰度
需要釐清
新手友好度
30/100

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。