Merge branch 'main' of bdgit.educoder.net:p8lxtapfy/stuManageSys

merge remote
main
高世波 1 year ago
commit bc304a6871

@ -3,7 +3,7 @@
void cancel(ss*stu){ void cancel(ss*stu){
char* tmp = (char*)malloc(sizeof(char)*3); char* tmp = (char*)malloc(sizeof(char)*3);
do{ do{
char*ID = (char*)malloc(sizeof(char)*5); char*ID = (char*)malloc(sizeof(char)*6);
scanf("%s",ID); scanf("%s",ID);
for(int i = 0; i < stu->nums; ++i){ for(int i = 0; i < stu->nums; ++i){
if(strcmp(stu->student[i].id,ID) == 0){ if(strcmp(stu->student[i].id,ID) == 0){
@ -12,6 +12,7 @@ void cancel(ss*stu){
} }
} }
} }
stu->nums--;
allPrint(stu); allPrint(stu);
printf("continue?\n"); printf("continue?\n");
scanf("%s",tmp); scanf("%s",tmp);

@ -1,4 +1,4 @@
#include "mysyslib.h" w#include "mysyslib.h"
ss* init(int Nums){ ss* init(int Nums){
ss* stu = (ss*)malloc(sizeof(ss)); ss* stu = (ss*)malloc(sizeof(ss));
@ -9,8 +9,8 @@
if(!stu->student) return NULL; if(!stu->student) return NULL;
for(int i = 0; i < Nums; ++i){ for(int i = 0; i < Nums; ++i){
stu->student[i].id = (char*)malloc(sizeof(char)*5); stu->student[i].id = (char*)malloc(sizeof(char)*6);
stu->student[i].class = (char*)malloc(sizeof(char)*2); stu->student[i].class = (char*)malloc(sizeof(char)*3);
stu->student[i].name = (char*)malloc(sizeof(char)*10); stu->student[i].name = (char*)malloc(sizeof(char)*10);
} }

Loading…
Cancel
Save