17070047 / 17070047/CodeStructureCourse

丁晓凡

Ouverte
#59 0 commentaires 0 réactions 0 personnes assignées Voir sur GitHub
Langage dominant
C++
Étoiles
16
Forks
2
Métriques de merge des PR
Aucune PR mergée en 30 j

Description

``` c
#include "stdafx.h"
#include"stdio.h"
#include"stdlib.h"
#include"string.h"
#define m 20
#define max 100
typedef struct studentnode{
char cardnum[m];
char name[m];
char classnum[m];
char college[m];
}node;
typedef struct{
node r[max+1];
int length;
}table;
void sort(table *tab,int left,int right)
{
int i,j;
if(leftr[0]=tab->r[i];
do
{ while(strcmp(tab->r[j].cardnum,tab->r[0].cardnum)==1&&ir[i]=tab->r[j];
i++;
}
while(strcmp(tab->r[i].cardnum,tab->r[0].cardnum)==-1&&ir[j]=tab->r[i];j--;}
}while(i!=j);
tab->r[i]=tab->r[0];
sort(tab,left,i-1);
sort(tab,i+1,right);
}
}
void creat(table *tab)
{
int i,j,k;
printf("请输入结点个数:\n");
scanf("%d",&tab->length);
tab->length++;
getchar();
for(i=1;ilength;i++)
{
printf("请输入卡号:\n");
gets(tab->r[i].cardnum);
printf("请输入名字:\n");
gets(tab->r[i].name);
printf("请输入班号:\n");
gets(tab->r[i].classnum);
printf("请输入系别:\n");
gets(tab->r[i].college);
printf("\n");
}
printf("创建完成\n");
}
void find(table *tab)
{
int i,j;
char object[m];
printf("请输入你要查找的系别:\n");
gets(object);
for(i=1;ilength;i++)
{ if(strcmp(object,tab->r[i].college)==0)
{ puts(tab->r[i].cardnum);
puts(tab->r[i].name); puts(tab->r[i].classnum); puts(tab->r[i].college);
printf("\n");
}
}
}
void display(table *tab)
{
int i;
for(i=1;ilength;i++)
{
puts(tab->r[i].cardnum);
puts(tab->r[i].name);
puts(tab->r[i].classnum);
puts(tab->r[i].college);
printf("\n");
}
}
int main()
{
int i;
table *tab;
tab=(table *)malloc(sizeof(table));
creat(tab);
sort(tab,1,tab->length-1);
display(tab);
while(scanf("%d",&i)!=EOF)
{
getchar();
find(tab);
}
return 0;
}
```
![00](https://user-images.githubusercontent.com/45329886/49648554-30111e00-fa61-11e8-90e4-6d85bfed940c.jpg)

Guide de contribution

Aucun guide de contribution indexé pour ce dépôt

Piste de recherche

The issue contains a C program with a student record management system. The code includes sorting, creation, display, and find functions. The image link is broken. A newcomer would need to understand the intended bug or improvement, but the issue lacks any description of what needs to be fixed. Start by examining the code for logical errors, memory leaks, or unsafe functions like gets(). Run the program to see if it compiles and behaves as expected. Determine what 'done' looks like by clarifying with the maintainer.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
c
Domaine
cli
Type d'issue
Bug
Difficulté
4/5
Temps estimé
3-5 jours
Activité
À l'abandon
Clarté
À clarifier
Accessibilité débutants
10/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.