• 排序


    #include<stdio.h>
    #include<string.h>
    struct Student{                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       
     char name[10];
     char sex[5];
     double grade; 
     };
     int main(void){
     struct Student student[10];
     int i,j;
     struct Student temp;
     for(i=0;i<10 ;i++){
      printf(" 请输入第%d个学生的信息: ",i+1);
      printf("姓名");
      char a[10];
      scanf("%s",&a);
      strcpy(student[i].name,a);
      printf(" 性别");
      char b[10];
      scanf("%s",&b);
      strcpy(student[i].sex,b);
      printf(" 成绩");
      scanf("%lf",&student[i].grade);
     }
     for(i=0;i<10;i++){
       for(j=i+1;j<10;j++){
       if(student[i].grade>student[j].grade){
       temp=student[i];
       student[i]=student[j];
       student[j]=temp;
       }
       }
     }
     for(i=0;i<10;i++){
     printf("%s %s %lf",student[i].name,student[i].sex,student[i].grade);
     }
     }

  • 相关阅读:
    装饰器
    kolla部署all-in-one
    k8s集群部署gitlab
    helm部署gitlab
    控制器和pod调度流程
    esxi安装
    Linux系统性能分析工具
    configMap和secret
    etcd 问题、调优、监控
    动感单车
  • 原文地址:https://www.cnblogs.com/jiafangfang/p/6062209.html
Copyright © 2020-2023  润新知