当前位置: 首页 > news >正文

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性能对比&#xff0c;从AICore到TensorCore&#xff0c;展现各自计算核心优势。 AI 2.0浪潮汹涌而来&#xff0c;若仍将其与区块链等量齐观&#xff0c;视作炒作泡沫&#xff0c;则将错失新时代的巨大机遇。现在&#xff0c;就是把握AI时代的关键…...

Edge 浏览器退出后,后台占用问题

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

实验八 T_SQL编程

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

【爆肝34万字】从零开始学Python第2天: 判断语句【入门到放弃】

目录 前言判断语句True、False简单使用作用 比较运算符引入比较运算符的分类比较运算符的结果示例代码总结 逻辑运算符引入逻辑运算符的简单使用逻辑运算符与比较运算符一起使用特殊情况下的逻辑运算符 if 判断语句引入基本使用案例演示案例补充随堂练习 else 判断子句引入else…...

React 19 新特性集合

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

耐高温水位传感器有哪些

耐高温水位传感器在现代液位检测技术中扮演着重要角色&#xff0c;特别适用于需要高温环境下稳定工作的应用场合。这类传感器的设计和材质选择对其性能和可靠性至关重要。 一种典型的耐高温水位传感器是FS-IR2016D&#xff0c;它采用了PPSU作为主要材质。PPSU具有优良的耐高温…...

Symfony国际化与本地化:打造多语言应用的秘诀

标题&#xff1a;Symfony国际化与本地化&#xff1a;打造多语言应用的秘诀 摘要 Symfony是一个高度灵活的PHP框架&#xff0c;用于创建Web应用程序。它提供了强大的国际化&#xff08;i18n&#xff09;和本地化&#xff08;l10n&#xff09;功能&#xff0c;允许开发者轻松创…...

ApolloClient GraphQL 与 ReactNative

要在 React Native 应用程序中设置使用 GraphQL 的简单示例&#xff0c;您需要遵循以下步骤&#xff1a; 设置一个 React Native 项目。安装 GraphQL 必要的依赖项。创建一个基本的 GraphQL 服务器&#xff08;或使用公共 GraphQL 端点&#xff09;。从 React Native 应用中的…...

【贡献法】2262. 字符串的总引力

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

C#基于SkiaSharp实现印章管理(3)

本系列第一篇文章中创建的基本框架限定了印章形状为矩形&#xff0c;但常用的印章有方形、圆形等多种形状&#xff0c;本文调整程序以支持定义并显示矩形、圆角矩形、圆形、椭圆等4种形式的印章背景形状。   定义印章背景形状枚举类型&#xff0c;矩形、圆形、椭圆相关的尺寸…...

如何理解泛型的编译期检查

既然说类型变量会在编译的时候擦除掉&#xff0c;那为什么我们往 ArrayList 创建的对象中添加整数会报错呢&#xff1f;不是说泛型变量String会在编译的时候变为Object类型吗&#xff1f;为什么不能存别的类型呢&#xff1f;既然类型擦除了&#xff0c;如何保证我们只能使用泛型…...

计算机组成原理:海明校验

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

信息学奥赛初赛天天练-39-CSP-J2021基础题-哈夫曼树、哈夫曼编码、贪心算法、满二叉树、完全二叉树、前中后缀表达式转换

PDF文档公众号回复关键字:20240629 2022 CSP-J 选择题 单项选择题&#xff08;共15题&#xff0c;每题2分&#xff0c;共计30分&#xff1a;每题有且仅有一个正确选项&#xff09; 5.对于入栈顺序为a,b,c,d,e的序列&#xff0c;下列( )不合法的出栈序列 A. a&#xff0c;b&a…...

第11章 规划过程组(收集需求)

第11章 规划过程组&#xff08;一&#xff09;11.3收集需求&#xff0c;在第三版教材第377~378页&#xff1b; 文字图片音频方式 第一个知识点&#xff1a;主要输出 1、需求跟踪矩阵 内容 业务需要、机会、目的和目标 项目目标 项目范围和 WBS 可…...

探索WebKit的守护神:深入Web安全策略

探索WebKit的守护神&#xff1a;深入Web安全策略 在数字化时代&#xff0c;网络已成为我们生活的一部分&#xff0c;而网页浏览器作为我们探索网络世界的窗口&#xff0c;其安全性至关重要。WebKit作为众多流行浏览器的内核&#xff0c;例如Safari&#xff0c;其安全性策略是保…...

unity ScrollRect裁剪ParticleSystem粒子

搜了下大概有这几种方法 通过模板缓存通过shader裁剪区域&#xff1a;案例一&#xff0c;案例二&#xff0c;案例三&#xff0c;三个案例都是类似的方法&#xff0c;需要在c#传入数据到shader通过插件 某乎上的模板缓存方法link&#xff0c;&#xff08;没有登录看不到全文&a…...

凤仪亭 | 第7集 | 大丈夫生居天地之间,岂能郁郁久居人下 | 司徒一言,令我拨云见日,茅塞顿开 | 三国演义 | 逐鹿群雄

&#x1f64b;大家好&#xff01;我是毛毛张! &#x1f308;个人首页&#xff1a; 神马都会亿点点的毛毛张 &#x1f4cc;这篇博客分享的是《三国演义》文学剧本第Ⅰ部分《群雄逐鹿》的第7️⃣集《凤仪亭》的经典语句和文学剧本全集台词 文章目录 1.经典语句2.文学剧本台词 …...

React实战学习(一)_棋盘设计

需求&#xff1a; 左上侧&#xff1a;状态左下侧&#xff1a;棋盘&#xff0c;保证胜利就结束 和 下过来的不能在下右侧&#xff1a;“时光机”,保证可以回顾&#xff0c;索引 语法&#xff1a; 父子之间属性传递&#xff08;props&#xff09;子父组件传递&#xff08;写法上&…...

业务系统对接大模型的基础方案:架构设计与关键步骤

业务系统对接大模型&#xff1a;架构设计与关键步骤 在当今数字化转型的浪潮中&#xff0c;大语言模型&#xff08;LLM&#xff09;已成为企业提升业务效率和创新能力的关键技术之一。将大模型集成到业务系统中&#xff0c;不仅可以优化用户体验&#xff0c;还能为业务决策提供…...

HTML 列表、表格、表单

1 列表标签 作用&#xff1a;布局内容排列整齐的区域 列表分类&#xff1a;无序列表、有序列表、定义列表。 例如&#xff1a; 1.1 无序列表 标签&#xff1a;ul 嵌套 li&#xff0c;ul是无序列表&#xff0c;li是列表条目。 注意事项&#xff1a; ul 标签里面只能包裹 li…...

令牌桶 滑动窗口->限流 分布式信号量->限并发的原理 lua脚本分析介绍

文章目录 前言限流限制并发的实际理解限流令牌桶代码实现结果分析令牌桶lua的模拟实现原理总结&#xff1a; 滑动窗口代码实现结果分析lua脚本原理解析 限并发分布式信号量代码实现结果分析lua脚本实现原理 双注解去实现限流 并发结果分析&#xff1a; 实际业务去理解体会统一注…...

06 Deep learning神经网络编程基础 激活函数 --吴恩达

深度学习激活函数详解 一、核心作用 引入非线性:使神经网络可学习复杂模式控制输出范围:如Sigmoid将输出限制在(0,1)梯度传递:影响反向传播的稳定性二、常见类型及数学表达 Sigmoid σ ( x ) = 1 1 +...

SpringTask-03.入门案例

一.入门案例 启动类&#xff1a; package com.sky;import lombok.extern.slf4j.Slf4j; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.cache.annotation.EnableCach…...

企业如何增强终端安全?

在数字化转型加速的今天&#xff0c;企业的业务运行越来越依赖于终端设备。从员工的笔记本电脑、智能手机&#xff0c;到工厂里的物联网设备、智能传感器&#xff0c;这些终端构成了企业与外部世界连接的 “神经末梢”。然而&#xff0c;随着远程办公的常态化和设备接入的爆炸式…...

Linux 中如何提取压缩文件 ?

Linux 是一种流行的开源操作系统&#xff0c;它提供了许多工具来管理、压缩和解压缩文件。压缩文件有助于节省存储空间&#xff0c;使数据传输更快。本指南将向您展示如何在 Linux 中提取不同类型的压缩文件。 1. Unpacking ZIP Files ZIP 文件是非常常见的&#xff0c;要在 …...

解读《网络安全法》最新修订,把握网络安全新趋势

《网络安全法》自2017年施行以来&#xff0c;在维护网络空间安全方面发挥了重要作用。但随着网络环境的日益复杂&#xff0c;网络攻击、数据泄露等事件频发&#xff0c;现行法律已难以完全适应新的风险挑战。 2025年3月28日&#xff0c;国家网信办会同相关部门起草了《网络安全…...

云原生周刊:k0s 成为 CNCF 沙箱项目

开源项目推荐 HAMi HAMi&#xff08;原名 k8s‑vGPU‑scheduler&#xff09;是一款 CNCF Sandbox 级别的开源 K8s 中间件&#xff0c;通过虚拟化 GPU/NPU 等异构设备并支持内存、计算核心时间片隔离及共享调度&#xff0c;为容器提供统一接口&#xff0c;实现细粒度资源配额…...

面试高频问题

文章目录 &#x1f680; 消息队列核心技术揭秘&#xff1a;从入门到秒杀面试官1️⃣ Kafka为何能"吞云吐雾"&#xff1f;性能背后的秘密1.1 顺序写入与零拷贝&#xff1a;性能的双引擎1.2 分区并行&#xff1a;数据的"八车道高速公路"1.3 页缓存与批量处理…...