• 324日常学习


    #include <stdio.h>
    #include <string.h>
    struct student
    {
    int num;
    char name[20];
    char sex;
    float scoer;
    }s1,s2;
    void testlogin();
    void testStrcat();
    void testStrcatArr();
    void testSaa();
    void main()
    {
    testSaa();
    /*s1.num=1;
    s1.name[0]="lisi";
    s1.sex='F';
    s1.scoer=90;
    s2=s1;
    struct student s3={2,"zhangsan",'N',66};
    printf("s3的学号是%d,姓名是%s,性别是%c,分数为%.1f ",s3.num,s3.name,s3.sex,s3.scoer);
    printf("------------------------------------------- ");
    printf("s1的学号是%d,姓名是%s,性别是%c,分数为%.1f ",s1.num,s1.name,s1.sex,s1.scoer);
    printf("------------------------------------------- ");
    printf("s2的学号是%d,姓名是%s,性别是%c,分数为%.1f ",s2.num,s2.name,s2.sex,s2.scoer);*/
    }

    /*void str()
    {
    char stra[]="hello world!";
    int len=strlen(stra);
    printf("%s的长度为%d ",stra,len);
    char strb[0];
    strcpy(strb,stra);
    printf("复制到strb后是%s ",strb);


    } */
    void testlogin()
    {

    char name[20],password[20],yzm[10];
    printf("请输入用户id:");
    gets(name);
    printf("请输入密码:");
    gets(password);
    printf("请输入验证码:");
    gets(yzm);
    if(strcmpi(yzm,"ABCD")==0)
    {
    if(strcmp(name,"ljs")==0&&strcmp(password,"1147")==0)
    {
    printf("登陆成功!");
    }else
    {
    printf("登陆失败");
    }
    }else
    {
    printf("你输入的验证码不正确!");
    }


    }
    void testStrcat()
    {
    char a[]="zzsxt,",b[]="good!";
    printf("链接前a是%s b是%s ",a,b);
    strcat(a,b);
    printf("链接后a是%s b是%s",a,b);

    }
    void testStrcatArr()
    {

    char *s1="zhangsan",*s2="lisi",*s3="wangwu",*s4="zhaoliu";
    char *names[]={*s1,*s2,*s3,*s4};
    printf("交换前name[2]是%s,name[3]是%s ",names[2],names[3]);
    char *temp;
    temp=names[2];
    names[2]=names[3];
    names[3]=temp;
    printf("交换后name[2]是%s,name[3]是%s",names[2],names[3]);
    }
    void testSaa()
    {
    struct student stu1={1,"范冰冰",'N',26};
    struct student stu2={2,"赵薇",'N',55};
    struct student stu3={3,"林心如",'N',45};
    struct student stu4={4,"成龙",'M',38};
    struct student stu5={5,"李连杰",'M',34};
    struct student stu6={6,"吴京",'M',35};
    printf("挂科的学员如下: ");
    if(stu1.scoer<60){
    printf("学号:%d 姓名:%s 性别:%c 分数:%.2f ",stu1.num,stu1.name,stu1.sex,stu1.scoer);
    }
    if(stu2.scoer<60){
    printf("学号:%d 姓名:%s 性别:%c 分数:%.2f ",stu2.num,stu2.name,stu2.sex,stu2.scoer);
    }
    if(stu3.scoer<60){
    printf("学号:%d 姓名:%s 性别:%c 分数:%.2f ",stu3.num,stu3.name,stu3.sex,stu3.scoer);
    if(stu4.scoer<60){
    printf("学号:%d 姓名:%s 性别:%c 分数:%.2f ",stu4.num,stu4.name,stu4.sex,stu4.scoer);
    }
    if(stu5.scoer<60){
    printf("学号:%d 姓名:%s 性别:%c 分数:%.2f ",stu5.num,stu5.name,stu5.sex,stu5.scoer);
    }
    if(stu6.scoer<60){
    printf("学号:%d 姓名:%s 性别:%c 分数:%.2f ",stu6.num,stu6.name,stu6.sex,stu6.scoer);
    }
    if(stu1.scoer>=60&&stu2.scoer>=60&&stu3.scoer>=60&&stu4.scoer>=60&&stu5.scoer>=60&&stu6.scoer>=60){
    printf("没有挂科的学员! ");
    }
    }
    }

  • 相关阅读:
    分布式文件系统HDFS体系
    开源分布式文件系统比较
    分布式文件系统FastDFS设计原理
    开源日志系统比较
    FMX.Controls单元 中图形矩阵变换
    磁波刀和海扶刀的区别
    pchar,pwidechar,pansichar作为返回参数时内存访问错误
    【笔记】每次开机后,第一次打开一个程序,比如浏览器或播放器,会比较慢。但关掉后第二次或第三次打开的话就会比较快了,这是为什么?
    DOS批处理中%cd%和%~dp0的异同分析
    [转]使用互斥对象让程序只运行一次(delphi)
  • 原文地址:https://www.cnblogs.com/1147blog/p/6612618.html
Copyright © 2020-2023  润新知