首页 > > 详细

解析C编程、C编程讲解留学生、辅导留学生C设计、C辅导留学生

#include
#include
#include
#include
void srand(unsigned int seed);
int system(const char *string);
typedef struct node {
char name[50];
int rank;
char number[20];
char idcard[20];
char password[20];
}Student;
/****************************************************/
/* : */
/* 1:studentList, */
/* 2: number ,id */
/* 3: studentNum, */
/* :1,,0 */
/****************************************************/
int free(Student studentList[1000], char number[20], int studentNum) {
int index = 0;
int begin;
if (studentNum == 1) {
studentNum = 0;
return 1;
}
for (index = 0; index if (strcmp(studentList[index].number, number) == 0) {
//
for (begin = index + 1; begin strcpy(studentList[begin - 1].name, studentList[begin].name);
strcpy(studentList[begin - 1].number, studentList[begin].number);
strcpy(studentList[begin - 1].idcard, studentList[begin].idcard);
studentList[begin - 1].rank = studentList[begin].rank;
strcpy(studentList[begin - 1].password, studentList[begin].password);
}
return 1;
}
}
return 0;
}
int main() {
char name[50]; //
char idcard[20]; //
char number[20]; //
char password[20]; //
int n, i;
char ch;
Student studentList[1000]; //
int login; //
int studentNumber = 0; //
int rank; //,
int regFlag; //
int find; //
srand((unsigned int)time(NULL));
int ut = 0;
while (1) {
printf("-------------------------------------\n");
printf("* *\n");
printf("-------------------------------------\n");
printf("* *\n");
printf("-------------------------------------\n");
printf("* (1) *\n");
printf("* (2) *\n");
printf("* (3) *\n");
printf("* (4) *\n");
printf("--------------------------------------\n");
scanf("%d", n);
switch (n) {
case 1:
printf(":\n");
scanf("%s", name);
strcpy(studentList[studentNumber].name, name);
printf(":\n");
scanf("%s", password);
strcpy(studentList[studentNumber].password, password);
regFlag = 0;
for (i = 0; i if ((strcmp(studentList[i].name, name) == 0 ) (strcmp(studentList[i].password, password) == 0)) {
regFlag = 1;
}
}
if (regFlag == 1) {
printf(",!");
getchar();
break;
}
printf("[18]:\n");
scanf("%s", idcard);
strcpy(studentList[studentNumber].idcard, idcard);
printf(":[12]\n");
scanf("%s", number);
strcpy(studentList[studentNumber].number, number);
//1-5, 【】
rank = rand() % 5 + 1;
studentList[studentNumber].rank = rank;
//,+1;
studentNumber++;
printf(",!\n");
case 2:
login = 0;
printf(":\n");
scanf("%s", name);
printf(": \n");
scanf("%s", password);
for (i = 0; i //。
if (strcmp(studentList[i].name, name) == 0 strcmp(studentList[i].password, password) == 0) {
login = 1;
printf("!");
}
}
if (!login) {
printf(",!");
}
break;
case 3:
printf("");
scanf("%s", number);
if (1 == free(studentList, number, studentNumber)) {
printf("!");
}
break;
case 4:
ut = 1;
default:
break;
}
if (out) {
break;
}
system("cls");
if (login == 1) {
printf("--------------------------------------\n");
printf(" *\n");
printf("--------------------------------------\n");
printf("* (1) *\n");
printf("* (2) *\n");
printf("* (3) *\n");
printf("* (4) *\n");
printf("* (5) *\n");
printf("--------------------------------------\n");
int close = 0;
while (scanf("%d", n) == 1) {
switch (n) {
case 1:
printf("[18]:\n");
scanf("%s", idcard);
find = 0;
for (int i = 0; i if (strcmp(studentList[i].idcard, idcard) == 0) {
printf(":\n");
printf("-------------------------------------------\n");
printf("%s\n", studentList[i].name);
printf("%s\n", studentList[i].idcard);
printf(":%s\n", studentList[i].number);
printf(":%d\n", studentList[i].rank);
printf("-------------------------------------------\n");
find = 1;
}
}
if (find == 0) {
printf("。\n");
}
getchar();
getchar();
break;
case 2:
printf(":\n");
scanf("%s", name);
find = 0;
for (int i = 0; i if (strcmp(studentList[i].name, name) == 0) {
printf(":\n");
printf("-------------------------------------------\n");
printf("%s\n", studentList[i].name);
printf("%s\n", studentList[i].idcard);
printf(":%s\n", studentList[i].number);
printf(":%d\n", studentList[i].rank);
printf("-------------------------------------------\n");
find = 1;
}
}
if (find == 0) {
printf("。\n");
}
getchar();
getchar();
break;
case 3:
printf("[12]:\n");
scanf("%s", number);
find = 0;
for (int i = 0; i if (strcmp(studentList[i].number, number) == 0) {
printf(":\n");
printf("-------------------------------------------\n");
printf("%s\n", studentList[i].name);
printf("%s\n", studentList[i].idcard);
printf(":%s\n", studentList[i].number);
printf(":%d\n", studentList[i].rank);
printf("-------------------------------------------\n");
find = 1;
}
}
if (find == 0) {
printf("。\n");
}
getchar();
getchar();
break;
case 4:
printf("[0-5]:\n");
scanf("%d", rank);
find = 0;
for (int i = 0; i if (studentList[i].rank == rank) {
printf("%d:\n", i);
printf("-------------------------------------------\n");
printf("%s\n", studentList[i].name);
printf("%s\n", studentList[i].idcard);
printf(":%s\n", studentList[i].number);
printf(":%d\n", studentList[i].rank);
printf("-------------------------------------------\n");
find = 1;
}
}
if (find == 0) {
printf("。\n");
}
getchar();
break;
case 5:
close = 1;
break;
default:
break;
}
if (close) {
break;
}
system("cls");
printf("--------------------------------------\n");
printf(" *\n");
printf("--------------------------------------\n");
printf("* (1) *\n");
printf("* (2) *\n");
printf("* (3) *\n");
printf("* (4) *\n");
printf("* (5) *\n");
printf("--------------------------------------\n");
}
system("cls");
}
}
return 0;
}
 

联系我们
  • QQ:99515681
  • 邮箱:99515681@qq.com
  • 工作时间:8:00-21:00
  • 微信:codinghelp
热点标签

联系我们 - QQ: 99515681 微信:codinghelp
程序辅导网!