240523:C语言学习日志

刷题记录

  • 所用网站:C语言网
  • 评价:
    较为经典,循序渐进,容易上手;
    刷题判别条件较为严谨,在scanf前面多一个printf语句都不行(- -)。

刷题进度

  • 编程入门-1002-1010
  • 未解决:1009(循环练得很少)

code

环境:Microsoft VS


//**第六章(1010)利润计算**
//#include<stdio.h>
//#include<math.h>
///*企业发放的奖金根据利润I提成。
//
//利润I低于或等于100000元的,奖金可提10%;
//(100000 < I≤200000)时,低于等于100000元部分按10%提成,高于100000元的部分,可提成 7.5 %;
//200000 < I≤400000时,低于200000元部分仍按上述办法提成(下同),高于200000元的部分按5%提成;
//400000 < I≤600000元时,高于400000元的部分按3%提成;
//600000 < I≤1000000时,高于600000元的部分按1.5 % 提成;
//I > 1000000时,超过1000000元的部分按1 % 提成。
//从键盘输入当月利润I, 求应发奖金总数。*/
一个整数,当月利润。
一个整数,奖金。
//int main() 
//{
//    int I, b;
//    scanf("%d", &I);
//    if (I <= 1e5)
//    {
//        b = 0.10 * I;
//    }
//    else if (I > 1e5 && I <= 2e5)
//    {
//        b = 0.10 * 1e5 + 0.075 * (I - 1e5);
//    }
//    else if (I > 2e5 && I <= 4e5)
//    {
//        b = 0.10 * 1e5 + 0.075 * (2e5 - 1e5) + 0.05 * (I - 2e5);
//    }
//    else if (I > 4e5 && I <= 6e5)
//    {
//        b = 0.10 * 1e5 + 0.075 * (2e5 - 1e5) + 0.05 * (4e5 - 2e5)+0.03*(I-4e5);
//    }
//    else if (I > 6e5 && I <= 1e6)
//    {
//        b = 0.10 * 1e5 + 0.075 * (2e5 - 1e5) + 0.05 * (4e5 - 2e5) + 0.03 * (6e5 - 4e5)+0.015*(I-6e5);
//    }
//    else if (I > 1e6)
//    {
//        b = 0.10 * 1e5 + 0.075 * (2e5 - 1e5) + 0.05 * (4e5 - 2e5) + 0.03 * (6e5 - 4e5)+0.015*(1e6-6e5)+0.01*(I-1e6);
//    }
//    printf("%d", b);
//    return 0;
//}
**第六章(1009)数字的处理与判断**
//#include<stdio.h>
//#include<math.h>
///*给出一个不多于5位的整数,要求
//1、求出它是几位数
//2、分别输出每一位数字
//3、按逆序输出各位数字,例如原数为321,应输出123*/
一个不大于5位的数字
三行 第一行 位数 第二行 用空格分开的每个数字,注意最后一个数字后没有空格 第三行 按逆序输出这个数
//int main()
//{
//    //1
//    int integer, temporary;
//    scanf("%d", &integer);
//    temporary = integer;
//    int i = 0;
//    /* if (integer == 0)
//     {
//     0的情况作业也没考虑
//     }*/
//    while (temporary > 0)
//    {
//        temporary /= 10;
//        i++;
//    }
//    printf("%d\n", i);
//    //2
//    int j;
//    for (j = i - 1; j >= 0; j--)
//    {
//        temporary = integer / pow(10, j);
//        printf("%d ", temporary % 10);
//    }
//    printf("\n");
//    //3
//    for (j = 0; j < i; j++)
//    {
//        temporary = integer / pow(10, j);
//        printf("%d", temporary % 10);
//    }
//    return 0;
//}
//**第六章(1008)成绩分段**
//#include<stdio.h>
///*一百分制成绩,要求输出成绩等级‘A’、‘B’、‘C’、‘D’、‘E’。 
//90分以及90分以上为A,80-89分为B,70-79分为C,60-69分为D,60分以下为E。*/
一个整数0-100以内
一个字符,表示成绩等级
//int main()
//{
//	int x;
//	int value;
//	scanf("%d",&x);
//	value = x / 10;
//	switch (value)
//	{
//	case (10):printf("A"); break;
//		case (9):printf("A"); break;
//		case(8):printf("B"); break;
//		case (7):printf("C"); break;
//		case (6):printf("D"); break;
//		case (5):printf("E"); break;
//		case(4):printf("E"); break;
//		case(3):printf("E"); break;
//		case(2):printf("E"); break;
//		case(1):printf("E"); break;
//		break;
//	}
//	return 0;
//	
//}
//**第六章(1007)分段函数**
//#include<stdio.h>
///*有一个函数
//y = { x      x < 1
//	| 2x - 1   1 <= x < 10
//	{ 3x - 11  x >= 10
//写一段程序,输入x,输出y*/
一个数x
一个数y
//int main()
//{
//	int x,y;
//	scanf("%d",&x);
//	if (x < 1)
//	{
//		y = x;
//	}
//	else if (x >= 1 && x <= 10)
//		//else if (10>=x >= 1 )
//	{
//		y = 2 * x - 1;
//	}
//	else if (x >= 10)
//	{
//		y = 3 * x - 11;
//	}
//	printf("%d", y);
//	return 0;
//	
//}
**第六章(1006)**
//#include<stdio.h>
三个整数a b c,由键盘输入,输出其中的最大的数。
一行数组,分别为a b c
a b c其中最大的数
//int main()
//{
//	int a, b, c, max;
//	scanf("%d%d%d", &a, &b, &c);
//	a = a > b ? a : b;
//	max = a > c ? a : c;
//	printf("%d", max);
//	return 0;
//
//}
**第五章(3)**
//#include<stdio.h>
拆分一个三位数的个位、十位、百位
输入一个三位数
逆序输出这个三位数,输出个位、十位、百位,三个数字,用空格分开
//int main()
//{
//    int a, m, n, o;
//    scanf("%d", &a);
//    m = a / 100;
//    n = a % 100 / 10;
//    o = a % 100 % 10;
//    printf("%d %d %d\n", o, n, m);
//    return 0;
//}
**第五章(2)**
//#include<stdio.h>
//#include <math.h>
//#define PI acos(-1)
已知半径r,求一个圆的面积是多大。
输入一个半径,浮点类型~
输出它对应的面积大小,保留两位小数。
//int main()
//{
//    float r,S;
//    scanf("%f",&r);
//    S = PI * r* r;
//    printf("%.2f", S);
//    return 0;
//}
**第五章(1)**
//#include<stdio.h>
输入一个华氏温度,要求输出摄氏温度。公式为 c=5(F-32)/9,取位2小数。
一个华氏温度,浮点数
摄氏温度,浮点两位小数
//int main()
//{
//    float F, C;
//    scanf("%f", &F);
//    C = 5 * (F - 32) / 9;
//    printf("C=%0.2f", C);
//    return 0;
//}
**第四章**
//#include<stdio.h>
要将"China"译成密码,译码规律是:用原来字母后面的第4个字母代替原来的字母.
例如,字母"A"后面第4个字母是"E"."E"代替"A"。因此,"China"应译为"Glmre"。
请编一程序,用赋初值的方法使cl、c2、c3、c4、c5五个变量的值分别为,’C’、’h’、’i’、’n’、’a’,
经过运算,使c1、c2、c3、c4、c5分别变为’G’、’l’、’m’、’r’、’e’,并输出。
//int main()
//{
//    char c1, c2, c3, c4, c5;
//    scanf("%c%c%c%c%c", &c1, &c2, &c3, &c4, &c5);
//    c1 += 4;
//    c2 += 4;
//    c3 += 4;
//    c4 += 4;
//    c5 += 4;
//    printf("%c%c%c%c%c", c1, c2, c3, c4, c5);
//    return 0;
//}
**第三章**
//#define _CRT_SECURE_NO_WARNINGS 1
输入一个整数,不超过10 ^ 9
输出这个整数的八进制、十进制和十六进制,三个数字用空格分开,最后一个有换行。不要忘记八进制和十六进制的前缀~
//#include <stdio.h>
//int main()
//{
//	int Z;
//	//printf("Plz input an integer:\n");
//	scanf("%d", &Z);
//	printf("%#o %#d %#x\n", Z, Z, Z);
//	return 0;
//	/*int Z;
//	printf("Plz input an integer:\n");
//	for (Z=0;Z <= 10e9;Z++) 
//	{
//		scanf("%d", &Z);
//		printf("%#o %#d %#x\n", Z, Z, Z);
//		
//	}
//	return 0;*/
//}
  • 5
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值