终于把这本书看完了,感觉自己学知识还是需要一项一项来~
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 (</