周末小练习:
1.确认基础类型所占用的内存空间。
#include <stdio.h>
int main() 
{
	
    printf("char: %u byte(s)\n", sizeof(char));
    printf("short: %u byte(s)\n", sizeof(short));
    printf("int: %u byte(s)\n", sizeof(int));
    printf("long: %u byte(s)\n", sizeof(long));
    printf("long long: %u byte(s)\n", sizeof(long long));
    printf("float: %u byte(s)\n", sizeof(float));
    printf("double: %u byte(s)\n", sizeof(double));
    printf("long double: %u byte(s)\n", sizeof(long double));
    return 0;
}
运行结果:

2.通过键盘输入一个通话秒数,编程显示通话用了几分钟几秒。
#include <stdio.h>
int main() 
{
    int total_seconds, minutes, seconds;
    // 获取用户输入的通话秒数
    printf("请输入通话的总秒数:");
    scanf("%d", &total_seconds);
    // 计算分钟和剩余秒数
    minutes = total_seconds / 60;   // 计算分钟数
    seconds = total_seconds % 60;   // 计算剩余的秒数
    // 输出结果
    printf("通话时长为:%d 分钟 %d 秒\n", minutes, seconds);
    return 0;
}
运行结果:

3.输入编程实现大写字母转为小写字母。
#include <stdio.h>
int main() {
    char uppercase = 'A';  // 大写字母 'A'
    char lowercase;
    // 转换大写字母为小写字母
    lowercase = uppercase + ('a' - 'A');
    printf("大写字母: %c\n小写字母: %c\n", uppercase, lowercase);
    return 0;
}
运行结果:

4.输入身高公制(cm),转换成英制(inch)(1inch = 2.54cm)。
#include <stdio.h>
int main() 
{
    float height_cm, height_inch;
    // 获取用户输入的身高(单位:厘米)
    printf("请输入您的身高(厘米):");
    scanf("%f", &height_cm);
    // 转换为英寸
    height_inch = height_cm / 2.54;
    // 输出转换结果
    printf("您的身高是:%.2f 厘米,%.2f 英寸\n", height_cm, height_inch);
    return 0;
}
运行结果:


















![[Windows CMD] 查看网络配置 ipconfig](https://i-blog.csdnimg.cn/direct/27f0e2ef4c894a58becbb394c4af9da1.png)

