Compare commits

..

No commits in common. 'e49ec82e46d9f347669a09fa110d07cd1d5e54d8' and '3db6a85c34ee77f685432e3cebab107cbedd2178' have entirely different histories.

63
1.c

@ -1,63 +0,0 @@
#include <stdio.h>
struct Data
{
int ID;
float score1;
float score2;
float score3;
} stu[1001];
int stl = 0;
float total(struct Data* a) {
return a->score1 + a->score2 + a->score3;
}
void swap(struct Data* a, struct Data* b) {
struct Data t = *a;
*a = *b;
*b = t;
}
void input1() {
scanf("%d", &stu[stl].ID);
scanf("%f", &stu[stl].score1);
scanf("%f", &stu[stl].score2);
scanf("%f", &stu[stl].score3);
stl++;
}
void Question1() {
printf("Please input info of three students:\n");
input1();input1();input1();
printf("%d %2.1f %2.1f %2.1f %.1f\n", stu[stl-3].ID, stu[stl-3].score1, stu[stl-3].score2, stu[stl-3].score3, total(&stu[stl-3]));
printf("%d %2.1f %2.1f %2.1f %.1f\n", stu[stl-2].ID, stu[stl-2].score1, stu[stl-2].score2, stu[stl-2].score3, total(&stu[stl-2]));
printf("%d %2.1f %2.1f %2.1f %.1f\n", stu[stl-1].ID, stu[stl-1].score1, stu[stl-1].score2, stu[stl-1].score3, total(&stu[stl-1]));
}
int main() {
printf(" 1.Input\n");
printf(" 2.Output\n");
printf(" 3.Order\n");
printf(" 4.Quit\n");
char t;
scanf("%c", &t);
switch(t) {
case 'i':
printf("You are trying to Input info\n");
break;
case 'o':
printf("You are trying to Output info\n");
break;
case 'm':
printf("You are trying to Make things ordered\n");
break;
case 'q':
printf("You are trying to Quit\n");
break;
default:
printf("Wrong input\n");
break;
}
}

56
2.c

@ -1,56 +0,0 @@
#include <stdio.h>
struct Data
{
int ID;
float score1;
float score2;
float score3;
} stu[1001];
int stl = 0;
float total(struct Data* a) {
return a->score1 + a->score2 + a->score3;
}
void swap(struct Data* a, struct Data* b) {
struct Data t = *a;
*a = *b;
*b = t;
}
void input1() {
scanf("%d", &stu[stl].ID);
scanf("%f", &stu[stl].score1);
scanf("%f", &stu[stl].score2);
scanf("%f", &stu[stl].score3);
stl++;
}
void Question1() {
printf("Please input info of three students:\n");
input1();input1();input1();
printf("%d %2.1f %2.1f %2.1f %.1f\n", stu[stl-3].ID, stu[stl-3].score1, stu[stl-3].score2, stu[stl-3].score3, total(&stu[stl-3]));
printf("%d %2.1f %2.1f %2.1f %.1f\n", stu[stl-2].ID, stu[stl-2].score1, stu[stl-2].score2, stu[stl-2].score3, total(&stu[stl-2]));
printf("%d %2.1f %2.1f %2.1f %.1f\n", stu[stl-1].ID, stu[stl-1].score1, stu[stl-1].score2, stu[stl-1].score3, total(&stu[stl-1]));
}
void Typein()
{
scanf("%d", &stu[stl].ID);
scanf("%f", &stu[stl].score1);
scanf("%f", &stu[stl].score2);
scanf("%f", &stu[stl].score3);
stl++;
}
int main() {
Typein();
Typein();
Typein();
printf("%d %2.1f %2.1f %2.1f %.1f\n", stu[stl-3].ID, stu[stl-3].score1, stu[stl-3].score2, stu[stl-3].score3, total(&stu[stl-3]));
printf("%d %2.1f %2.1f %2.1f %.1f\n", stu[stl-2].ID, stu[stl-2].score1, stu[stl-2].score2, stu[stl-2].score3, total(&stu[stl-2]));
printf("%d %2.1f %2.1f %2.1f %.1f\n", stu[stl-1].ID, stu[stl-1].score1, stu[stl-1].score2, stu[stl-1].score3, total(&stu[stl-1]));
}

67
3.c

@ -1,67 +0,0 @@
#include <stdio.h>
struct Data
{
int ID;
float score1;
float score2;
float score3;
} stu[1001];
int stl = 0, sortstl;
float total(struct Data* a) {
return a->score1 + a->score2 + a->score3;
}
void swap(struct Data* a, struct Data* b) {
struct Data t = *a;
*a = *b;
*b = t;
}
void input1() {
scanf("%d", &stu[stl].ID);
scanf("%f", &stu[stl].score1);
scanf("%f", &stu[stl].score2);
scanf("%f", &stu[stl].score3);
stl++;
}
void Input() {
printf("Please input info of three students:\n");
input1();input1();input1();
if (total(&stu[stl-3]) < total(&stu[stl-2])) swap(&stu[stl-3], &stu[stl-2]);
if (total(&stu[stl-2]) < total(&stu[stl-1])) swap(&stu[stl-2], &stu[stl-1]);
if (total(&stu[stl-3]) < total(&stu[stl-2])) swap(&stu[stl-3], &stu[stl-2]);
printf("%d,%.1f,%.1f\n", stu[stl-3].ID, total(&stu[stl-3]), total(&stu[stl-3])/3.0f);
printf("%d,%.1f,%.1f\n", stu[stl-2].ID, total(&stu[stl-2]), total(&stu[stl-2])/3.0f);
printf("%d,%.1f,%.1f\n", stu[stl-1].ID, total(&stu[stl-1]), total(&stu[stl-1])/3.0f);
}
int main() {
printf(" 1.Input\n");
printf(" 2.Output\n");
printf(" 3.Order\n");
printf(" 4.Quit\n");
char t;
scanf("%c", &t);
switch(t) {
case 'i':
printf("You are trying to Input info\n");
Input();
break;
case 'o':
printf("You are trying to Output info\n");
break;
case 'm':
printf("You are trying to Make things ordered\n");
break;
case 'q':
printf("You are trying to Quit\n");
break;
default:
printf("Wrong input\n");
break;
}
}

89
4.c

@ -1,89 +0,0 @@
#include <stdio.h>
struct Data
{
int ID;
int Class;
float score1;
float score2;
float score3;
} stu[1001];
int stl = 0;
struct Data* stuflag;
float total(struct Data* a) {
return a->score1 + a->score2 + a->score3;
}
void swap(struct Data* a, struct Data* b) {
struct Data t = *a;
*a = *b;
*b = t;
if (a == stuflag) stuflag = b;
else
if (b == stuflag) stuflag = a;
}
void Sort() {
int i, j;
for(i = 0; i < stl-1; i++) {
for (j = 0; j < stl-i-1; j++) {
if (stu[j].Class < stu[j+1].Class) continue;
if (stu[j].Class > stu[j+1].Class ||
total(&stu[j]) < total(&stu[j+1])) swap(&stu[j], &stu[j+1]);
}
}
}
void input1() {
scanf("%d", &stu[stl].ID);
scanf("%f", &stu[stl].score1);
scanf("%f", &stu[stl].score2);
scanf("%f", &stu[stl].score3);
stl++;
}
void Input() {
printf("Please input info of three students:\n");
input1();input1();input1();
if (total(&stu[stl-3]) < total(&stu[stl-2])) swap(&stu[stl-3], &stu[stl-2]);
if (total(&stu[stl-2]) < total(&stu[stl-1])) swap(&stu[stl-2], &stu[stl-1]);
if (total(&stu[stl-3]) < total(&stu[stl-2])) swap(&stu[stl-3], &stu[stl-2]);
printf("%d,%.1f,%.1f\n", stu[stl-3].ID, total(&stu[stl-3]), total(&stu[stl-3])/3.0f);
printf("%d,%.1f,%.1f\n", stu[stl-2].ID, total(&stu[stl-2]), total(&stu[stl-2])/3.0f);
printf("%d,%.1f,%.1f\n", stu[stl-1].ID, total(&stu[stl-1]), total(&stu[stl-1])/3.0f);
}
void print1(struct Data* a) {
printf("%d %d %2.1f %2.1f %2.1f", a->ID, a->Class,
a->score1, a->score2, a->score3);
if (a == stuflag) printf(" inserted");
printf("\n");
}
void Insert() {
stu[0] = (struct Data){10001, 11, 99.5, 88.5, 89.5};
stu[1] = (struct Data){10002, 12, 77.9, 56.5, 87.5};
stu[2] = (struct Data){10003, 11, 92.5, 89.0, 60.5};
stl = 3;
scanf("%d", &stu[stl].ID);
scanf("%d", &stu[stl].Class);
scanf("%f", &stu[stl].score1);
scanf("%f", &stu[stl].score2);
scanf("%f", &stu[stl].score3);
stl++;
stuflag = stu + 3;
Sort();
print1(stu + 0);
print1(stu + 1);
print1(stu + 2);
print1(stu + 3);
}
int main() {
Insert();
}

112
5.c

@ -1,112 +0,0 @@
#include <stdio.h>
#include <string.h>
struct Data
{
int ID;
int Class;
float score1;
float score2;
float score3;
char name[101];
} stu[1001];
int stl = 0;
struct Data* stuflag = 0;
float total(struct Data* a) {
return a->score1 + a->score2 + a->score3;
}
void swap(struct Data* a, struct Data* b) {
struct Data t = *a;
*a = *b;
*b = t;
if (a == stuflag) stuflag = b;
else
if (b == stuflag) stuflag = a;
}
void Sort() {
int i, j;
for(i = 0; i < stl-1; i++) {
for (j = 0; j < stl-i-1; j++) {
if (stu[j].Class < stu[j+1].Class) continue;
if (stu[j].Class > stu[j+1].Class ||
total(&stu[j]) < total(&stu[j+1])) swap(&stu[j], &stu[j+1]);
}
}
}
void input1() {
scanf("%d", &stu[stl].ID);
scanf("%f", &stu[stl].score1);
scanf("%f", &stu[stl].score2);
scanf("%f", &stu[stl].score3);
stl++;
}
void Input() {
printf("Please input info of three students:\n");
input1();input1();input1();
if (total(&stu[stl-3]) < total(&stu[stl-2])) swap(&stu[stl-3], &stu[stl-2]);
if (total(&stu[stl-2]) < total(&stu[stl-1])) swap(&stu[stl-2], &stu[stl-1]);
if (total(&stu[stl-3]) < total(&stu[stl-2])) swap(&stu[stl-3], &stu[stl-2]);
printf("%d,%.1f,%.1f\n", stu[stl-3].ID, total(&stu[stl-3]), total(&stu[stl-3])/3.0f);
printf("%d,%.1f,%.1f\n", stu[stl-2].ID, total(&stu[stl-2]), total(&stu[stl-2])/3.0f);
printf("%d,%.1f,%.1f\n", stu[stl-1].ID, total(&stu[stl-1]), total(&stu[stl-1])/3.0f);
}
void print1(struct Data* a) {
printf("%d %d %s %2.1f %2.1f %2.1f", a->ID, a->Class, a->name,
a->score1, a->score2, a->score3);
if (a == stuflag) printf(" inserted");
printf("\n");
}
void Remove(struct Data* r) {
for(; r+1 < stu+stl; r++) {
*r = *(r+1);
}
stl--;
}
void Delete() {
stu[0] = (struct Data){10001, 11, 99.5, 88.5, 89.5, "Zhang"};
stu[1] = (struct Data){10002, 12, 77.9, 56.5, 87.5, "Yang"};
stu[2] = (struct Data){10003, 11, 92.5, 89.0, 60.5, "Liang"};
stl = 3;
int ID = -1; char name[101];
scanf("%s", name);
getchar();
int NumFlag = 1, i;
for(i = 0; name[i]!='\0'; i++)
if (name[i] < '0' || name[i] > '9') {
NumFlag = 0; break;
}
if (NumFlag) {
sscanf(name, "%d", &ID);
name[0] = '\0';
}
printf("Are you sure(yes/no)?\n");
char t;
scanf("%c", &t);
if (t == 'y') {
for(i=0; i<stl; i++) {
if(stu[i].ID == ID || name[0]!='\0' && strcmp(stu[i].name, name) == 0) {
Remove(stu + i);
break;
}
}
}
for (i=0; i<stl; i++) {
print1(stu + i);
}
}
int main() {
Delete();
}

100
6.c

@ -1,100 +0,0 @@
#include <stdio.h>
#include <string.h>
struct Data
{
int ID;
int Class;
float score1;
float score2;
float score3;
char name[101];
} stu[1001];
int stl = 0;
struct Data* stuflag = 0;
float total(struct Data* a) {
return a->score1 + a->score2 + a->score3;
}
void swap(struct Data* a, struct Data* b) {
struct Data t = *a;
*a = *b;
*b = t;
if (a == stuflag) stuflag = b;
else
if (b == stuflag) stuflag = a;
}
void Sort() {
int i, j;
for(i = 0; i < stl-1; i++) {
for (j = 0; j < stl-i-1; j++) {
if (stu[j].Class < stu[j+1].Class) continue;
if (stu[j].Class > stu[j+1].Class ||
total(&stu[j]) < total(&stu[j+1])) swap(&stu[j], &stu[j+1]);
}
}
}
void input1() {
scanf("%d", &stu[stl].ID);
scanf("%f", &stu[stl].score1);
scanf("%f", &stu[stl].score2);
scanf("%f", &stu[stl].score3);
stl++;
}
void Input() {
printf("Please input info of three students:\n");
input1();input1();input1();
if (total(&stu[stl-3]) < total(&stu[stl-2])) swap(&stu[stl-3], &stu[stl-2]);
if (total(&stu[stl-2]) < total(&stu[stl-1])) swap(&stu[stl-2], &stu[stl-1]);
if (total(&stu[stl-3]) < total(&stu[stl-2])) swap(&stu[stl-3], &stu[stl-2]);
printf("%d,%.1f,%.1f\n", stu[stl-3].ID, total(&stu[stl-3]), total(&stu[stl-3])/3.0f);
printf("%d,%.1f,%.1f\n", stu[stl-2].ID, total(&stu[stl-2]), total(&stu[stl-2])/3.0f);
printf("%d,%.1f,%.1f\n", stu[stl-1].ID, total(&stu[stl-1]), total(&stu[stl-1])/3.0f);
}
void Modify() {
struct Data t;
scanf("%d", &t.ID);
scanf("%d", &t.Class);
scanf("%s", t.name);
scanf("%f", &t.score1);
scanf("%f", &t.score2);
scanf("%f", &t.score3);
int i;
for(i=0; i<stl; i++) {
if (t.ID == stu[i].ID) {
stu[i] = t;
stuflag = stu + i;
break;
}
}
Sort();
for(i=0; i<stl; i++) {
if (i>0 && stu[i].Class == stu[i-1].Class) printf(" ");
else printf("%2d ", stu[i].Class);
printf("%d %s %2.1f %2.1f %2.1f", stu[i].ID, stu[i].name,
stu[i].score1, stu[i].score2, stu[i].score3);
if (stuflag == stu + i) printf(" modified");
printf("\n");
}
}
int main() {
stu[0] = (struct Data){10001, 11, 99.5, 88.5, 89.5, "Zhang"};
stu[1] = (struct Data){10002, 12, 77.9, 56.5, 87.5, "Yang"};
stu[2] = (struct Data){10003, 11, 92.5, 89.0, 60.5, "Liang"};
stl = 3;
Modify();
}

132
7.c

@ -1,132 +0,0 @@
#include <stdio.h>
#include <string.h>
struct Data
{
int ID;
int Class;
float score1;
float score2;
float score3;
char name[101];
} stu[1001];
int stl = 0;
struct Data* stuflag = 0;
float total(struct Data* a) {
return a->score1 + a->score2 + a->score3;
}
void swap(struct Data* a, struct Data* b) {
struct Data t = *a;
*a = *b;
*b = t;
if (a == stuflag) stuflag = b;
else
if (b == stuflag) stuflag = a;
}
void Sort() {
int i, j;
for(i = 0; i < stl-1; i++) {
for (j = 0; j < stl-i-1; j++) {
if (stu[j].Class < stu[j+1].Class) continue;
if (stu[j].Class > stu[j+1].Class ||
total(&stu[j]) < total(&stu[j+1])) swap(&stu[j], &stu[j+1]);
}
}
}
void input1() {
scanf("%d", &stu[stl].ID);
scanf("%f", &stu[stl].score1);
scanf("%f", &stu[stl].score2);
scanf("%f", &stu[stl].score3);
stl++;
}
void Input() {
printf("Please input info of three students:\n");
input1();input1();input1();
if (total(&stu[stl-3]) < total(&stu[stl-2])) swap(&stu[stl-3], &stu[stl-2]);
if (total(&stu[stl-2]) < total(&stu[stl-1])) swap(&stu[stl-2], &stu[stl-1]);
if (total(&stu[stl-3]) < total(&stu[stl-2])) swap(&stu[stl-3], &stu[stl-2]);
printf("%d,%.1f,%.1f\n", stu[stl-3].ID, total(&stu[stl-3]), total(&stu[stl-3])/3.0f);
printf("%d,%.1f,%.1f\n", stu[stl-2].ID, total(&stu[stl-2]), total(&stu[stl-2])/3.0f);
printf("%d,%.1f,%.1f\n", stu[stl-1].ID, total(&stu[stl-1]), total(&stu[stl-1])/3.0f);
}
void Print1(int i)
{
printf("%d %d %s %.1f %.1f %.1f\n", stu[i].ID, stu[i].Class, stu[i].name,
stu[i].score1, stu[i].score2, stu[i].score3);
}
void Search() {
int t; char com[101];
int i;
scanf("%d %s", &t, com);
switch(t) {
case 1: {
int from, to;
sscanf(com, "%d-%d", &from, &to);
for (i=0; i<stl; i++) {
if (stu[i].Class >= from && stu[i].Class <= to)
Print1(i);
}
}break;
case 2: {
int from, to;
sscanf(com, "%d-%d", &from, &to);
for (i=0; i<stl; i++) {
if (stu[i].ID >= from && stu[i].ID <= to)
Print1(i);
}
}break;
case 3: {
for (i=0; i<stl; i++) {
int flag = 1, j;
for (j=0; com[j] != '*'; j++) {
if (stu[i].name[j] != com[j]) {
flag = 0; break;
}
}
if(flag)
Print1(i);
}
}break;
case 4: {
float gate;
sscanf(com, "%f", &gate);
for (i=0; i<stl; i++) {
if (total(stu + i) >= gate - 0.01f)
Print1(i);
}
}break;
case 5: {
int Class, from, to;
sscanf(com, "%d.%d-%d", &Class, &from, &to);
for (i=0; i<stl; i++) {
if (stu[i].ID >= from && stu[i].ID <= to)
if (stu[i].Class == Class)
Print1(i);
}
}
}
}
int main() {
stu[0] = (struct Data){10001, 11, 99.5, 88.5, 89.5, "Zhang"};
stu[1] = (struct Data){10002, 12, 77.9, 56.5, 87.5, "Yang"};
stu[2] = (struct Data){10003, 11, 92.5, 89.0, 60.5, "Liang"};
stu[3] = (struct Data){10004, 11, 89.6, 56.9, 90.5, "Cai"};
stu[4] = (struct Data){10005, 14, 55.6, 67.9, 98.9, "Fu"};
stu[5] = (struct Data){10006, 12, 22.1, 45.9, 99.2, "Mao"};
stu[6] = (struct Data){10007, 13, 35.6, 67.9, 88.0, "Zhan"};
stl = 7;
Sort();
Search();
}

245
8.c

@ -1,245 +0,0 @@
#include <stdio.h>
#include <string.h>
struct Data
{
int ID;
int Class;
float score1;
float score2;
float score3;
char name[101];
} stu[1001];
int stl = 0;
struct Data* stuflag = 0;
float total(struct Data* a) {
return a->score1 + a->score2 + a->score3;
}
void swap(struct Data* a, struct Data* b) {
struct Data t = *a;
*a = *b;
*b = t;
if (a == stuflag) stuflag = b;
else
if (b == stuflag) stuflag = a;
}
void Sort() {
int i, j;
for(i = 0; i < stl-1; i++) {
for (j = 0; j < stl-i-1; j++) {
if (stu[j].Class < stu[j+1].Class) continue;
if (stu[j].Class > stu[j+1].Class ||
total(&stu[j]) < total(&stu[j+1])) swap(&stu[j], &stu[j+1]);
}
}
}
void input1() {
scanf("%d", &stu[stl].ID);
scanf("%f", &stu[stl].score1);
scanf("%f", &stu[stl].score2);
scanf("%f", &stu[stl].score3);
stl++;
}
void Input() {
printf("Please input info of three students:\n");
input1();input1();input1();
if (total(&stu[stl-3]) < total(&stu[stl-2])) swap(&stu[stl-3], &stu[stl-2]);
if (total(&stu[stl-2]) < total(&stu[stl-1])) swap(&stu[stl-2], &stu[stl-1]);
if (total(&stu[stl-3]) < total(&stu[stl-2])) swap(&stu[stl-3], &stu[stl-2]);
printf("%d,%.1f,%.1f\n", stu[stl-3].ID, total(&stu[stl-3]), total(&stu[stl-3])/3.0f);
printf("%d,%.1f,%.1f\n", stu[stl-2].ID, total(&stu[stl-2]), total(&stu[stl-2])/3.0f);
printf("%d,%.1f,%.1f\n", stu[stl-1].ID, total(&stu[stl-1]), total(&stu[stl-1])/3.0f);
}
void Print1(int i)
{
printf("%d,%d,%s,%.1f,%.1f,%.1f,%.1f\n", stu[i].ID, stu[i].Class, stu[i].name,
stu[i].score1, stu[i].score2, stu[i].score3, total(&stu[i]));
}
void Search() {
int t; char com[101];
int i;
scanf("%d %s", &t, com);
switch(t) {
case 1: {
int from, to;
sscanf(com, "%d-%d", &from, &to);
for (i=0; i<stl; i++) {
if (stu[i].Class >= from && stu[i].Class <= to)
Print1(i);
}
}break;
case 2: {
int from, to;
sscanf(com, "%d-%d", &from, &to);
for (i=0; i<stl; i++) {
if (stu[i].ID >= from && stu[i].ID <= to)
Print1(i);
}
}break;
case 3: {
for (i=0; i<stl; i++) {
int flag = 1, j;
for (j=0; com[j] != '*'; j++) {
if (stu[i].name[j] != com[j]) {
flag = 0; break;
}
}
if(flag)
Print1(i);
}
}break;
case 4: {
float gate;
sscanf(com, "%f", &gate);
for (i=0; i<stl; i++) {
if (total(stu + i) >= gate - 0.01f)
Print1(i);
}
}break;
case 5: {
int Class, from, to;
sscanf(com, "%d.%d-%d", &Class, &from, &to);
for (i=0; i<stl; i++) {
if (stu[i].ID >= from && stu[i].ID <= to)
if (stu[i].Class == Class)
Print1(i);
}
}
}
}
void Output() {
int i;
for(i=0; i<stl; i++) {
printf("%d,%d,%s,%.1f,%.1f,%.1f,%.1f\n", stu[i].ID, stu[i].Class, stu[i].name,
stu[i].score1, stu[i].score2, stu[i].score3, total(&stu[i]));
}
}
void Typein()
{
printf("Id ");
scanf("%d", &stu[stl].ID);
printf("class ");
scanf("%d", &stu[stl].Class);
printf("name ");
scanf("%s", stu[stl].name);
printf("score1 ");
scanf("%f", &stu[stl].score1);
printf("score2 ");
scanf("%f", &stu[stl].score2);
printf("score3 ");
scanf("%f", &stu[stl].score3);
stl++;
}
void Delete() {
int ID = -1; char name[101];
scanf("%s", name);
getchar();
int NumFlag = 1, i;
for(i = 0; name[i]!='\0'; i++)
if (name[i] < '0' || name[i] > '9') {
NumFlag = 0; break;
}
if (NumFlag) {
sscanf(name, "%d", &ID);
name[0] = '\0';
}
for(i=0; i<stl; i++) {
if(stu[i].ID == ID || (name[0]!='\0' && strcmp(stu[i].name, name) == 0)) {
struct Data* r = stu + i;
for(; r+1 < stu+stl; r++) {
*r = *(r+1);
}
stl--;
break;
}
}
Output();
}
void Select_3() {
char com[101];
scanf("%s", com);
int NumFlag = 1, i;
for(i = 0; com[i]!='\0'; i++)
if (com[i] < '0' || com[i] > '9') {
NumFlag = 0; break;
}
if (NumFlag) {
int num;
sscanf(com, "%d", &num);
if (strlen(com) > 2)
for (i=0; i<stl; i++) {
if (stu[i].Class == num)
Print1(i);
}
else
for (i=0; i<stl; i++)
if (stu[i].ID == num)
Print1(i);
}
else {
for (i=0; i<stl; i++)
if (strcmp(stu[i].name, com) == 0)
Print1(i);
}
}
int main() {
char com[11];
while(1) {
printf("1.input\n");
printf("2.delete\n");
printf("3.select\n");
printf("4.order\n");
printf("5.output\n");
printf("6.quit\n");
printf("please input your option\n");
int t; scanf("%d", &t);
switch(t) {
case 1:
do{
Typein();
printf("continue?\n");
scanf("%s", com);
}while(strcmp(com, "yes") == 0);
Sort();
break;
case 2:
do {
Delete();
printf("continue?\n");
scanf("%s", com);
}while(strcmp(com, "yes") == 0);
break;
case 3:
do {
Select_3();
printf("continue?\n");
scanf("%s", com);
}while(strcmp(com, "yes") == 0);
break;
case 4:
Sort();
Output();
break;
case 5:
Output();
break;
case 6:
return 0;
break;
}
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 MiB

Loading…
Cancel
Save