明解C语言入门篇(第13章练习题)

博主完成了C语言书籍的学习,尤其关注第13章的所有练习题,通过逐步解决这些题目,深化了对C语言的理解。虽然已进入CPP的学习,但认为不同知识点的交叉复习对技能提升很重要。
摘要由CSDN通过智能技术生成

终于把这本书看完了,感觉自己学知识还是需要一项一项来~

13.1

#include<stdio.h>

int main(void)
{
   
    char s[128];
    FILE *fp;

    printf("请输入要打开的文件名: ");
    scanf("%s", s);
    fp = fopen(s, "r");
    if (fp == NULL)
        printf("该文件不存在。\n");
    else
        printf("该文件存在。\n");

    return 0;
}

13.2

#include<stdio.h>

int main(void)
{
   
    char s[128];

    printf("请输入要打开的文件名: ");
    scanf("%s", s);
    fopen(s, "w");

    return 0;
}

13.3

#include<stdio.h>

#define NUMBER 6

typedef struct{
   
    char name[100];
    double height;
    double weight;
}Student;

void swap_Student(Student *x, Student *y)
{
   
    Student temp = *x;
    *x = *y;
    *y = temp;
}

void sort_by_height(Student *s, int n)
{
   
    int i, j;

    for (</
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值