摘要: 1 #include <stdio.h> 2 int main(){ 3 FILE *fp; 4 fp=fopen("data4.txt","r"); 5 int line=0,chars=0; 6 char ch; 7 if(!fp){ 8 perror("data4.txt"); 9 retur 阅读全文
posted @ 2025-12-31 18:59 nanxinyin 阅读(8) 评论(1) 推荐(0)
摘要: 1 #include <stdio.h> 2 #define N 10 3 4 typedef struct { 5 char isbn[20]; // isbn号 6 char name[80]; // 书名 7 char author[80]; // 作者 8 double sales_pric 阅读全文
posted @ 2025-12-25 23:40 nanxinyin 阅读(12) 评论(1) 推荐(0)
摘要: 一 1: 1)把数组中最大最小值赋给相应地址变量 2)min和max的地址 2: 1)找到数组最大值,返回最早出现的最大值元素的地址。 2)可以 二: 1: 1)大小为80;计算数组所占字节数;统计字符串长度; 2)不能;s1是常量,不能被赋值; 3)交换 2: 1)存放L的地址;计算指针所占字节数 阅读全文
posted @ 2025-12-16 16:07 nanxinyin 阅读(8) 评论(1) 推荐(0)
摘要: 1 #include <stdio.h> 2 #define N 5 3 4 void input(int x[], int n); 5 void output(int x[], int n); 6 void find_min_max(int x[], int n, int *pmin, int * 阅读全文
posted @ 2025-12-12 15:11 nanxinyin 阅读(14) 评论(2) 推荐(0)
摘要: 任务1: 1 #include<stdio.h> 2 #include<stdlib.h> 3 #define N 4 4 #define M 2 5 6 void test1(){ 7 int x[N]={1,9,8,4}; 8 int i; 9 printf("sizeof(x)=%d\n",s 阅读全文
posted @ 2025-11-17 13:16 nanxinyin 阅读(11) 评论(1) 推荐(0)
摘要: 任务1: 1 #include <stdio.h> 2 3 char score_to_grade(int score); // 函数声明 4 5 int main() { 6 int score; 7 char grade; 8 9 while(scanf("%d", &score) != EOF 阅读全文
posted @ 2025-11-03 13:36 nanxinyin 阅读(5) 评论(1) 推荐(0)
摘要: 任务1: 1 int main() { 2 3 int cnt; 4 int random_major, random_no; 5 srand(time(NULL)); 6 cnt = 0; 7 while(cnt < N) { 8 random_major = rand() % 2; 9 if(r 阅读全文
posted @ 2025-10-19 17:22 nanxinyin 阅读(13) 评论(1) 推荐(0)
摘要: 实验任务1: #include <stdio.h> int main() { printf(" O \n"); printf("<H>\n"); printf("I I\n"); printf(" O \n"); printf("<H>\n"); printf("I I\n"); return 0; 阅读全文
posted @ 2025-10-08 16:29 nanxinyin 阅读(8) 评论(1) 推荐(0)