2022.3.22

 //          2022.3.22
//  隐式类型转换
//#define _CRT_SECURE_NO_WARNINGS
//#include <stdio.h>
//#include <string.h>
//#include <stdlib.h>
//#include <math.h>
//#include <time.h>
//
//int main(void)
//{
//    int a = 321;
//
//    char ch = a;
//
//    printf("ch = %d\n", ch);
//    
//    system("pause");
//    return EXIT_SUCCESS;
//}
//   

//       强制类型转换
//#define _CRT_SECURE_NO_WARNINGS
//#include <stdio.h>
//#include <string.h>
//#include <stdlib.h>
//#include <math.h>
//#include <time.h>
//  
//int main(void)
//{
//    float price = 3.6;
//    int weight = 4;
//
//    double sum = price * weight;
//        printf("价格:%lf\n", sum);
//
//    system("panse");
//    return EXIT_SUCCESS;
//}

//#define _CRT_SECURE_NO_WARNINGS
//#include <stdio.h>
//#include <string.h>
//#include <stdlib.h>
//#include <math.h>
//#include <time.h>
//
//int main(void)
//{
//    float price = 3.6;
//    int weight = 4;
//
//    double sum = (int) price * weight;
//    printf("价格:%lf\n", sum);
//
//    system("panse");
//    return EXIT_SUCCESS;
//}

//#define _CRT_SECURE_NO_WARNINGS
//#include <stdio.h>
//#include <string.h>
//#include <stdlib.h>
//#include <math.h>
//#include <time.h>
//
//int main(void)
//{
//    int *p = (int *)malloc(100);
//    float price = 3.6;
//    int weight = 4;
//
//    double sum = (int) (price * weight);
//    printf("价格:%lf\n", sum);
//
//    system("panse");
//    return EXIT_SUCCESS;
//}
//
//   类型转换:
//    隐式类型转换:
//        由编译器自动完成。
//        由赋值产生的类型转换
//        int r = 3;
//        float s = 3.14 * r * r;
//    321  :    256  128  64  32  16  8  4  2  1 
//               1     0   1  0    0  0  0  0  1
//        char  ch  =  0  1 0 0 0 0 0 1 
//  
// 
// 
//   强制类型转换
//     语法:  (目标类型)带转换变量
//                (目标类型)带转换表达式
//        大多数用于函数调用期间,实参给形参传值


//
//#define _CRT_SECURE_NO_WARNINGS
//#include <stdio.h>
//#include <string.h>
//#include <stdlib.h>
//#include <math.h>
//#include <time.h>
//
//int main(void)
//{
//    int a;
//   
//   scanf("%d", &a);
// 
//   if (a > 0)
//    {
//      printf("a > 0\n");
//    }
//   else
//   {
//       printf("a <= 0\n");
//   }
//    system("panse");
//    return EXIT_SUCCESS;
//}

//#define _CRT_SECURE_NO_WARNINGS
//#include <stdio.h>
//#include <string.h>
//#include <stdlib.h>
//#include <math.h>
//#include <time.h>
//
//int main(void)
//{
//    int score;  //  100-90 优 90-70 良好 70-60 及格 <60 差劲
//    printf("请输入学生成绩:");
//        scanf("%d", &score);
//
//    if (score >= 90 && score <= 100)
//    {
//        printf("优秀\n");
//    }
//    else if (score < 90 && score >= 70)
//    {
//        printf("良好\n");
//    }
//    else if (score < 70 && score >= 60)
//    {
//        printf("及格\n");
//    }
//    else if (score < 60)
//    {
//        printf("差劲");
//    }
//    system("panse");
//    return EXIT_SUCCESS;
//}

//#define _CRT_SECURE_NO_WARNINGS
//#include <stdio.h>
//#include <string.h>
//#include <stdlib.h>
//#include <math.h>
//#include <time.h>
//
//int main(void)
//{
//    int score;  //  100-90 优 90-70 良好 70-60 及格 <60 差劲
//    printf("请输入学生成绩:");
//    scanf("%d", &score);
//
//    if (score >= 90 && score <= 100)
//    {
//        printf("优秀\n");
//    }
//    else if (score < 90 && score >= 70)
//    {
//        printf("良好\n");
//    }
//    else if (score < 70 && score >= 60)
//    {
//        printf("及格\n");
//    }
//    else 
//    {
//        printf("差劲");
//    }
//    system("panse");
//    return EXIT_SUCCESS;
//}

//       2022.3.23

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值