6.27-6.29 旧c语言
#include<stdio.h>
struct stu
{int num;float score;struct stu *next;
};
void main()
{struct stu a,b,c,*head;//静态链表a.num = 1;a.score = 10;b.num = 2;b.score = 20;c.num = 3;c.score = 30;head = &a;a.next = &b;b.next = &c;do{printf("%d,%5.1f\n",head->num,head->score);head = head->next;}while(head != NULL);
}
#include<stdio.h>
#include<stdlib.h>
#define LEN sizeof(struct stu)
int n;
struct stu
{int num;float score;struct stu *next;
};
struct stu *creat()//建立动态链表
{struct stu *p1,*p2,*head;p1 = p2 = (struct stu *)malloc(LEN);printf("input num:\n");scanf("%d",&p1->num);printf("input score:\n");scanf("%f",&p1->score);head = NULL,n = 0;while(p1->num != 0){n++;if(n == 1){head = p1;}else{p2->next = p1;}p2 = p1;//p1 = (struct stu *)malloc(LEN);printf("input num:\n");scanf("%d",&p1->num);printf("input score:\n");scanf("%f",&p1->score);}p2->next = NULL;return head;}
void print(struct stu *head)
{struct stu *p;printf("there are %d record stu\n",n);p = head;if(head != NULL){do{printf("num = %d,score = %f\n",p->num,p->score);p = p->next;}while(p);//直到p为空结点退出循环}
}
void main()
{struct stu *p;p = creat();print(p);
}
#include<stdio.h>//增删改查
#include<stdlib.h>
#define LEN sizeof(struct stu)
struct stu *del(struct stu *head,int n);
struct stu *creat();
void print(struct stu *head);
int n;
struct stu
{int num;float score;struct stu *next;
};
struct stu *del(struct stu *head,int m)
{struct stu *p1,*p2;p1 = head;if(head == NULL)//判断是否为空链表{printf("this is kong node\n");return NULL;}while(p1->num != m && p1->next != NULL)//删除的值不是当前结点,且当前结点不为尾节点{p2 = p1;p1 = p1->next;}if(p1->num == m)//找到节点{if(p1 == head)//如果当前节点为头结点{head = p1->next;}else//此时为普通结点{p2->next = p1->next;}printf("del NO:%d success!\n",m);n = n-1;}else{printf("%d no found!\n",n);}return head;
}
struct stu *creat()
{struct stu *p1,*p2,*head;p1 = p2 = (struct stu *)malloc(LEN);printf("input num:\n");scanf("%d",&p1->num);printf("input score:\n");scanf("%f",&p1->score);head = NULL,n = 0;while(p1->num != 0){n++;if(n == 1){head = p1;}else{p2->next = p1;}p2 = p1;p1 = (struct stu *)malloc(LEN);printf("input num:\n");scanf("%d",&p1->num);printf("input score:\n");scanf("%f",&p1->score);}p2->next = NULL;return head;}
void print(struct stu *head)
{struct stu *p;printf("there are %d record stu\n",n);p = head;if(head != NULL){do{printf("num = %d,score = %f\n",p->num,p->score);p = p->next;}while(p);}
}
void main()
{struct stu *stu,*p;int k;stu = creat();p = stu;print(p);printf("del num is:\n");scanf("%d",&k);print(del(p,k));
}
#include<stdio.h>
#include<stdlib.h>
#define LEN sizeof(struct stu)
struct stu *del(struct stu *head,int n);
struct stu *creat();
void print(struct stu *head);
struct stu *inser(struct stu *head,struct stu *ins);
struct stu *lookfor(struct stu *head,struct stu *look);
struct stu *wrilink(struct stu *head,struct stu *stu4);
struct stu
{int num;float score;struct stu *next;
};
int n;
struct stu *wrilink(struct stu *head,struct stu *stu4)
{struct stu *p;p = head;if(head == NULL){printf("无数据可修改!\n");}else{while(p != NULL){if(p->num == stu4->num){p->score = stu4->score;}p = p->next;}}return head;
}
struct stu *lookfor(struct stu *head,struct stu *look)
{struct stu *p;p = head;if(p == NULL){printf("没有数据!\n");}else{while(p != NULL){if(p->num == look->num){printf("找到第%d个数据,分数为%f\n",p->num,p->score);}p = p->next;}}return head;
}
struct stu *inser(struct stu *head,struct stu *ins)
{struct stu *p1,*p2,*p0;p0 = ins;p1 = head;if(head == NULL){head = p0;p0->next = NULL;}else{while((p0->num >p1->num) && (p1->next != NULL)){p2 = p1;p1 = p1->next;}if(p0->num <= p1->num){if(p1 == head){head = p0;}else{p2->next = p0;}p0->next = p1;}else{p1->next = p0;p0->next = NULL;}n = n+1;return head;}
}
struct stu *del(struct stu *head,int m)
{struct stu *p1,*p2;p1 = head;if(head == NULL){printf("this is kong node\n");return NULL;}while(p1->num != m && p1->next != NULL){p2 = p1;p1 = p1->next;}if(p1->num == m){if(p1 == head){head = p1->next;}else{p2->next = p1->next;}printf("del NO:%d success!\n",m);n = n-1;}else{printf("%d no found!\n",n);}return head;
}
struct stu *creat()
{struct stu *p1,*p2,*head;p1 = p2 = (struct stu *)malloc(LEN);printf("input num:\n");scanf("%d",&p1->num);printf("input score:\n");scanf("%f",&p1->score);head = NULL,n = 0;while(p1->num != 0){n++;if(n == 1){head = p1;}else{p2->next = p1;}p2 = p1;p1 = (struct stu *)malloc(LEN);printf("input num:\n");scanf("%d",&p1->num);printf("input score:\n");scanf("%f",&p1->score);}p2->next = NULL;return head;}
void print(struct stu *head)
{struct stu *p;printf("there are %d record stu\n",n);p = head;if(head != NULL){do{printf("num = %d,score = %f\n",p->num,p->score);p = p->next;}while(p != NULL);}
}
void main()
{struct stu *stu,*p,stu2,stu3,stu4;int k;stu = creat();p = stu;print(p);printf("del num is:\n");scanf("%d",&k);print(del(p,k));printf("insert into the num:");scanf("%d",&stu2.num);printf("insert into the score:");scanf("%f",&stu2.score);p = inser(stu,&stu2);print(p);printf("请输入查找的数据是:");scanf("%d",&stu3.num);lookfor(stu,&stu3);printf("请输入修改的学号:");scanf("%d",&stu4.num);printf("请输入修改的学号数据:");scanf("%f",&stu4.score);p = wrilink(stu,&stu4);print(p);
}
typedef 声明新的类型名来代替已有的类型名,有利于程序通用与移植
#include<stdio.h>
typedef struct
{int year;int month;int day;
}date;
void main()
{date da;da.year = 1995;da.month = 8;da.day = 9;printf("%d--%d--%d\n",da.year,da.month,da.day);
}
#include<stdio.h>
typedef int num[100];//声明um为整型数组类型
void main()
{num n = {0};printf("%d\n",sizeof(n));
}
#include<stdio.h>
typedef void (*p)();
void fun()
{printf("funny\n");
}
void main()
{p p1;p1 = fun;//函数指针指向函数的入口p1();
}
相关文章:

6.27-6.29 旧c语言
#include<stdio.h> struct stu {int num;float score;struct stu *next; }; void main() {struct stu a,b,c,*head;//静态链表a.num 1;a.score 10;b.num 2;b.score 20;c.num 3;c.score 30;head &a;a.next &b;b.next &c;do{printf("%d,%5.1f\n&…...

Unidbg调用-补环境V3-Hook
结合IDA和unidbg,可以在so的执行过程进行Hook,这样可以让我们了解并分析具体的执行步骤。 应用场景:基于unidbg调试执行步骤 或 还原算法(以Hookzz为例)。 1.大姨妈 1.1 0x1DA0 public void hook1() {...

从AICore到TensorCore:华为910B与NVIDIA A100全面分析
华为NPU 910B与NVIDIA GPU A100性能对比,从AICore到TensorCore,展现各自计算核心优势。 AI 2.0浪潮汹涌而来,若仍将其与区块链等量齐观,视作炒作泡沫,则将错失新时代的巨大机遇。现在,就是把握AI时代的关键…...

Edge 浏览器退出后,后台占用问题
Edge 浏览器退出后,后台占用问题 环境 windows 11 Microsoft Edge版本 126.0.2592.68 (正式版本) (64 位)详情 在关闭Edge软件后,查看后台,还占用很多系统资源。实在不明白,关了浏览器还不能全关了,微软也学流氓了。…...

实验八 T_SQL编程
题目 以电子商务系统数据库ecommerce为例 1、在ecommerce数据库,针对会员表member首先创建一个“呼和浩特地区”会员的视图view_hohhot,然后通过该视图查询来自“呼和浩特”地区的会员信息,用批处理命令语句将问题进行分割,并分…...

【爆肝34万字】从零开始学Python第2天: 判断语句【入门到放弃】
目录 前言判断语句True、False简单使用作用 比较运算符引入比较运算符的分类比较运算符的结果示例代码总结 逻辑运算符引入逻辑运算符的简单使用逻辑运算符与比较运算符一起使用特殊情况下的逻辑运算符 if 判断语句引入基本使用案例演示案例补充随堂练习 else 判断子句引入else…...

React 19 新特性集合
前言:https://juejin.cn/post/7337207433868197915 新 React 版本信息 伴随 React v19 Beta 的发布,React v18.3 也一并发布。 React v18.3相比最后一个 React v18 的版本 v18.2 ,v18.3 添加了一些警告提示,便于尽早发现问题&a…...

耐高温水位传感器有哪些
耐高温水位传感器在现代液位检测技术中扮演着重要角色,特别适用于需要高温环境下稳定工作的应用场合。这类传感器的设计和材质选择对其性能和可靠性至关重要。 一种典型的耐高温水位传感器是FS-IR2016D,它采用了PPSU作为主要材质。PPSU具有优良的耐高温…...
Symfony国际化与本地化:打造多语言应用的秘诀
标题:Symfony国际化与本地化:打造多语言应用的秘诀 摘要 Symfony是一个高度灵活的PHP框架,用于创建Web应用程序。它提供了强大的国际化(i18n)和本地化(l10n)功能,允许开发者轻松创…...

ApolloClient GraphQL 与 ReactNative
要在 React Native 应用程序中设置使用 GraphQL 的简单示例,您需要遵循以下步骤: 设置一个 React Native 项目。安装 GraphQL 必要的依赖项。创建一个基本的 GraphQL 服务器(或使用公共 GraphQL 端点)。从 React Native 应用中的…...

【贡献法】2262. 字符串的总引力
本文涉及知识点 贡献法 LeetCode2262. 字符串的总引力 字符串的 引力 定义为:字符串中 不同 字符的数量。 例如,“abbca” 的引力为 3 ,因为其中有 3 个不同字符 ‘a’、‘b’ 和 ‘c’ 。 给你一个字符串 s ,返回 其所有子字符…...

C#基于SkiaSharp实现印章管理(3)
本系列第一篇文章中创建的基本框架限定了印章形状为矩形,但常用的印章有方形、圆形等多种形状,本文调整程序以支持定义并显示矩形、圆角矩形、圆形、椭圆等4种形式的印章背景形状。 定义印章背景形状枚举类型,矩形、圆形、椭圆相关的尺寸…...
如何理解泛型的编译期检查
既然说类型变量会在编译的时候擦除掉,那为什么我们往 ArrayList 创建的对象中添加整数会报错呢?不是说泛型变量String会在编译的时候变为Object类型吗?为什么不能存别的类型呢?既然类型擦除了,如何保证我们只能使用泛型…...

计算机组成原理:海明校验
在上图中,对绿色的7比特数据进行海明校验,需要添加紫色的4比特校验位,总共是蓝色的11比特。紫色的校验位pi分布于蓝色的hi的1, 2, 4, 8, 16, 32, 64位,是2i-1位。绿色的数据位bi分布于剩下的位。 在下图中,b1位于h3&a…...

信息学奥赛初赛天天练-39-CSP-J2021基础题-哈夫曼树、哈夫曼编码、贪心算法、满二叉树、完全二叉树、前中后缀表达式转换
PDF文档公众号回复关键字:20240629 2022 CSP-J 选择题 单项选择题(共15题,每题2分,共计30分:每题有且仅有一个正确选项) 5.对于入栈顺序为a,b,c,d,e的序列,下列( )不合法的出栈序列 A. a,b&a…...

第11章 规划过程组(收集需求)
第11章 规划过程组(一)11.3收集需求,在第三版教材第377~378页; 文字图片音频方式 第一个知识点:主要输出 1、需求跟踪矩阵 内容 业务需要、机会、目的和目标 项目目标 项目范围和 WBS 可…...
探索WebKit的守护神:深入Web安全策略
探索WebKit的守护神:深入Web安全策略 在数字化时代,网络已成为我们生活的一部分,而网页浏览器作为我们探索网络世界的窗口,其安全性至关重要。WebKit作为众多流行浏览器的内核,例如Safari,其安全性策略是保…...
unity ScrollRect裁剪ParticleSystem粒子
搜了下大概有这几种方法 通过模板缓存通过shader裁剪区域:案例一,案例二,案例三,三个案例都是类似的方法,需要在c#传入数据到shader通过插件 某乎上的模板缓存方法link,(没有登录看不到全文&a…...

凤仪亭 | 第7集 | 大丈夫生居天地之间,岂能郁郁久居人下 | 司徒一言,令我拨云见日,茅塞顿开 | 三国演义 | 逐鹿群雄
🙋大家好!我是毛毛张! 🌈个人首页: 神马都会亿点点的毛毛张 📌这篇博客分享的是《三国演义》文学剧本第Ⅰ部分《群雄逐鹿》的第7️⃣集《凤仪亭》的经典语句和文学剧本全集台词 文章目录 1.经典语句2.文学剧本台词 …...

React实战学习(一)_棋盘设计
需求: 左上侧:状态左下侧:棋盘,保证胜利就结束 和 下过来的不能在下右侧:“时光机”,保证可以回顾,索引 语法: 父子之间属性传递(props)子父组件传递(写法上&…...

解决Ubuntu22.04 VMware失败的问题 ubuntu入门之二十八
现象1 打开VMware失败 Ubuntu升级之后打开VMware上报需要安装vmmon和vmnet,点击确认后如下提示 最终上报fail 解决方法 内核升级导致,需要在新内核下重新下载编译安装 查看版本 $ vmware -v VMware Workstation 17.5.1 build-23298084$ lsb_release…...
线程与协程
1. 线程与协程 1.1. “函数调用级别”的切换、上下文切换 1. 函数调用级别的切换 “函数调用级别的切换”是指:像函数调用/返回一样轻量地完成任务切换。 举例说明: 当你在程序中写一个函数调用: funcA() 然后 funcA 执行完后返回&…...

CMake基础:构建流程详解
目录 1.CMake构建过程的基本流程 2.CMake构建的具体步骤 2.1.创建构建目录 2.2.使用 CMake 生成构建文件 2.3.编译和构建 2.4.清理构建文件 2.5.重新配置和构建 3.跨平台构建示例 4.工具链与交叉编译 5.CMake构建后的项目结构解析 5.1.CMake构建后的目录结构 5.2.构…...

蓝牙 BLE 扫描面试题大全(2):进阶面试题与实战演练
前文覆盖了 BLE 扫描的基础概念与经典问题蓝牙 BLE 扫描面试题大全(1):从基础到实战的深度解析-CSDN博客,但实际面试中,企业更关注候选人对复杂场景的应对能力(如多设备并发扫描、低功耗与高发现率的平衡)和前沿技术的…...

什么是库存周转?如何用进销存系统提高库存周转率?
你可能听说过这样一句话: “利润不是赚出来的,是管出来的。” 尤其是在制造业、批发零售、电商这类“货堆成山”的行业,很多企业看着销售不错,账上却没钱、利润也不见了,一翻库存才发现: 一堆卖不动的旧货…...

Module Federation 和 Native Federation 的比较
前言 Module Federation 是 Webpack 5 引入的微前端架构方案,允许不同独立构建的应用在运行时动态共享模块。 Native Federation 是 Angular 官方基于 Module Federation 理念实现的专为 Angular 优化的微前端方案。 概念解析 Module Federation (模块联邦) Modul…...

04-初识css
一、css样式引入 1.1.内部样式 <div style"width: 100px;"></div>1.2.外部样式 1.2.1.外部样式1 <style>.aa {width: 100px;} </style> <div class"aa"></div>1.2.2.外部样式2 <!-- rel内表面引入的是style样…...

Map相关知识
数据结构 二叉树 二叉树,顾名思义,每个节点最多有两个“叉”,也就是两个子节点,分别是左子 节点和右子节点。不过,二叉树并不要求每个节点都有两个子节点,有的节点只 有左子节点,有的节点只有…...
【Java学习笔记】BigInteger 和 BigDecimal 类
BigInteger 和 BigDecimal 类 二者共有的常见方法 方法功能add加subtract减multiply乘divide除 注意点:传参类型必须是类对象 一、BigInteger 1. 作用:适合保存比较大的整型数 2. 使用说明 创建BigInteger对象 传入字符串 3. 代码示例 import j…...

【7色560页】职场可视化逻辑图高级数据分析PPT模版
7种色调职场工作汇报PPT,橙蓝、黑红、红蓝、蓝橙灰、浅蓝、浅绿、深蓝七种色调模版 【7色560页】职场可视化逻辑图高级数据分析PPT模版:职场可视化逻辑图分析PPT模版https://pan.quark.cn/s/78aeabbd92d1...