diff --git a/t3.c b/t3.c deleted file mode 100644 index 379601a..0000000 --- a/t3.c +++ /dev/null @@ -1,96 +0,0 @@ -#include -typedef struct INFO -{ - int num; - float Maths; - float Physics; - float English; - float sum; - float average; -}Info; -Info stu[3]; -void menu(); -void info(); -void grade_sort(); -int main() -{ - menu(); - info(); - grade_sort(); -} -void info() -{ - for (int i = 0; i < 3; i++) - { - scanf("%d%f%f%f", &stu[i].num, &stu[i].Maths, &stu[i].Physics, &stu[i].English); - } -} -void menu() -{ - for (int i = 0; i < 30; i++) - { - printf(" "); - } - printf("1.Input\n"); - for (int i = 0; i < 30; i++) - { - printf(" "); - } - printf("2.Output\n"); - for (int i = 0; i < 30; i++) - { - printf(" "); - } - printf("3.Order\n"); - for (int i = 0; i < 30; i++) - { - printf(" "); - } - printf("4.Quit\n"); - char c; - scanf("%c", &c); - if (c == 'i') - { - printf("Please input info of the three students:\n"); - } - else if (c == 'o') - { - printf("You are trying to Output info\n"); - } - else if (c == 'm') - { - printf("You are trying to Make things ordered\n"); - } - else if (c == 'q') - { - printf("You are about to Quit\n"); - } - else{ - printf("Wrong input\n"); - } -} -void grade_sort() -{ - for (int i = 0; i < 3; i++) - { - stu[i].sum = stu[i].Maths + stu[i].Physics + stu[i].English; - stu[i].average = stu[i].sum / 3; - } - for (int i = 0; i < 3; i++) - { - - for (int j = 2; j > i; j--) - { - if (stu[j].sum < stu[j - 1].sum) - { - Info tmp = stu[j]; - stu[j] = stu[j - 1]; - stu[j - 1] = tmp; - } - } - } - for (int i = 0; i < 3; i++) - { - printf("%d,%.1f,%.1f\n", stu[i].num, stu[i].sum, stu[i].average); - } -} \ No newline at end of file