深圳前50强网站建设公司/域名历史查询工具
嘿嘿,uu们,今天咱们来详解字符函数与字符串函数,好啦,废话不多讲,开干!
1.:字符分类函数
C语言中又一系列的函数是专门做字符分类的,也就是一个字符属于什么类型的字符的,这些函数的使用需要包含头文件ctype.h
这些函数的使用方法都十分类似,博主在这里就举两到三个例子,其他的都是换汤不换药~
1.1:islower函数
islower函数是能够判断参数部分的c是否是小写字符的
通过返回值来判断是否是小写字母,如果是小写字母就返回非0的整数,如果不是小写字母,则返回0.
#include <stdio.h>
#include <ctype.h>
int main()
{char c = 'a';char a = 'A';printf("%d %d\n", islower(c), islower(a));return 0;
}
1.2:isspace函数
isspacer函数是能够判断参数部分的c是否是空白字符:空格' ’,换页'\f',换行'\n',回车'\r',制表符'\t'或者垂直制表符'\v'的.
通过返回值来判断是否是空白字符:空格' ’,换页'\f',换行'\n',回车'\r',制表符'\t'或者垂直制表符'\v',如果是这些字符,则返回非0的整数,反之则返回0.
#include <stdio.h>
#include <ctype.h>
int main()
{char a = ' ';char b = '\v';char c = 'A';char d = '\t';printf("%d\n",isspace(c));printf("%d\n",isspace(b));printf("%d\n",isspace(a));printf("%d\n",isspace(d));return 0;
}
2.字符转换函数
C语言提供了2个字符转换函数.
1.:int tolower ( int c ); //将参数传进去的⼩写字⺟转⼤写2.:int toupper ( int c ); //将参数传进去的⼤写字⺟转⼩写


#include <stdio.h>
#include <ctype.h>
int main()
{int i = 0;char str[] = "Test String Function.\n";char c;while (str[i]){c = str[i];//若为小写字符if (islower(c))//转换为大写字符c = toupper(c);//若为大写字符else if (isupper(c))//转换为小写字符c = tolower(c);putchar(c);i++;}return 0;
}
3.strlen函数的使用与模拟实现
3.1:strlen的使用
size_t strlen ( const char * str );
- 字符串以'\0'作为结束标志,strlen函数返回的是在字符串中'\0'前面出现的字符个数(不包含'\0').
- 参数指向的字符串必须要以'\0'结束.
- 注意函数的返回值为size_t,是无符号的.
#include <stdio.h>
#include <string.h>
int main()
{const char* str1 = "abcdefg";const char* str2 = "abde";if (strlen(str1) > strlen(str2))printf("str1 > str2");elseprintf("str2 > str1");return 0;
}
3.2:strlen的模拟实现
3.2.1:计数器的方式
#include <stdio.h>
#include <string.h>
#include <assert.h>
int my_strlen(const char* str)
{//避免传过来的指针是空指针assert(str);//统计字符出现的个数int count = 0;while (*str != '\0'){count++;str++;}return count;
}
int main()
{const char* str = "abcdefg";printf("%zd\n", my_strlen(str));return 0;
}
上述方式则是通过计数器的方式模拟实现strlen,当*str = '\0'时,此时跳出循环.
3.2.2:递归的方式
#include <stdio.h>
#include <string.h>
#include <assert.h>
int my_strlen(const char* str)
{assert(str);if (*str == '\0')return 0;return 1 + my_strlen(str + 1);
}
int main()
{const char* str = "abcdefg";printf("%zd\n", my_strlen(str));return 0;
}
3.2.3:指针-指针的方式
#define _CRT_SECURE_NO_WARNINGS
#include <assert.h>
#include <stdio.h>
int mystrlen(const char* str)
{assert(str);//记录起始位置const char* begin = str;while (*str != '\0'){str++;}return str - begin;
}int main()
{const char* str = "abcdef";int result = mystrlen(str);printf("%d\n", result);return 0;
}
4:strcpy函数的使用与实现.
strcpy函数的功能是将soure指向的字符串拷贝到destination,同时也会拷贝'\0'.
char* strcpy(char * destination, const char * source );
- 源字符串必须以'\0'结束.
- 会将源字符串中的'\0'拷贝到目标空间.
- 目标空间必须足够大,以确保能存放到源字符串.
- 目标空间必须可变.
4.1:strcpy函数的使用
#define _CRT_SECURE_NO_WARNINGS
#include <assert.h>
#include <stdio.h>
#include <string.h>int main()
{char str1[200]= "abc";char str2[150]="hello world";printf("拷贝前:%s\n", str1);strcpy(str1,str2);printf("拷贝后:%s\n",str1);return 0;
}
4.2:strcpy函数的模拟实现
#define _CRT_SECURE_NO_WARNINGS
#include <assert.h>
#include <stdio.h>
#include <string.h>char* my_strcpy(char* destination, const char* source)
{char* result = destination;//防止空指针的传递assert(destination && source);while(*source != '\0'){//拷贝当前字符*destination = *source;destination++;source++;}//拷贝'\0'*destination = *source;return result;
}int main()
{char str1[200]= "abc";char str2[150]="hello world";printf("请输入源头字符串:>");scanf("%s",str1);printf("请输入要拷贝的字符串:>");scanf("%s",str2);printf("拷贝前:%s\n", str1);my_strcpy(str1, str2);printf("拷贝后:%s\n",str1);return 0;
}
5:strcat函数的使用与实现
strcat的功能是追加字符串,将目标字符串追加到源字符串的后面,同时也会追加\0'.
- 源字符串必须以'\0'结束.
- 目标字符串也得有'\0',否则没办法知道追加从哪里开始.
- 目标空间必须有足够的大,能够容纳下源字符串的内容.
- 目标空间必须可修改.
5.1:strcat函数的使用
#define _CRT_SECURE_NO_WARNINGS
#include <assert.h>
#include <stdio.h>
#include <string.h>int main()
{char str1[200]= "abc";char str2[150]="hello world";printf("追加前:%s\n", str1);strcat(str1, str2);printf("追加后:%s\n",str1);return 0;
}
5.2:strcat函数的模拟实现
#define _CRT_SECURE_NO_WARNINGS
#include <assert.h>
#include <stdio.h>
#include <string.h>char* my_strcat(char* destination, const char* source)
{char* result = destination;//防止空指针的传递assert(destination && source);//目标字符串遍历到'\0'的位置while (*destination != '\0'){destination++;}while (*source != '\0'){//进行追加*destination = *source;destination++;source++;}//拷贝'\0'*destination = *source;return result;
}int main()
{char str1[200]= "abc";char str2[150]="hello world";printf("请输入源头字符串:>");scanf("%s",str1);printf("请输入要拷贝的字符串:>");scanf("%s",str2);printf("追加前:%s\n", str1);my_strcat(str1, str2);printf("追加后:%s\n",str1);return 0;
}
6:strcmp的使用与模拟实现
strcmp的功能是比较字符串的大小.
- 第⼀个字符串大于第二个字符串,则返回⼤于0的数字
- 第⼀个字符串等于第二个字符串,则返回0
- 第⼀个字符串小于第二个字符串,则返回⼩于0的数字
- 那么如何判断两个字符串? ⽐较两个字符串中对应位置上字符ASCII码值的大小.
6.1:strcmp的使用
#define _CRT_SECURE_NO_WARNINGS
#include <assert.h>
#include <stdio.h>
#include <string.h>int main()
{char str1[200]= "abc";char str2[150]="hello world";printf("请输入源头字符串:>");scanf("%s",str1);printf("请输入要比较的字符串:>");scanf("%s",str2);if(strcmp(str1,str2) > 0){printf("str1 > str2\n");}else if (strcmp(str1, str2) == 0){printf("str1 == str2");}else{printf("str1 < str2");}return 0;
}
6.2:strcmp的模拟实现
#define _CRT_SECURE_NO_WARNINGS
#include <assert.h>
#include <stdio.h>
#include <string.h>int my_strcmp(const char * str1,const char * str2)
{//防止空字符串assert(str1);assert(str2);//越过相等的字符while(*str1 == *str2){/*确认当循环退出时(即*str1和*str2不再相等)如果* str1 是 '\0',则说明 str1 和 str2 是相等的,因为它们都到达了结束符*/if (*str1 == '\0')return 0;str1++;str2++;}return *str1 - *str2;
}int main()
{char str1[200]= "abc";char str2[150]="hello world";printf("请输入源头字符串:>");scanf("%s",str1);printf("请输入要比较的字符串:>");scanf("%s",str2);if(my_strcmp(str1,str2) > 0){printf("str1 > str2\n");}else if (my_strcmp(str1, str2) == 0){printf("str1 == str2");}else{printf("str1 < str2");}return 0;
}
7:strncpy函数的使用与模拟实现
7.1:strncpy函数的使用
char * strncpy ( char * destination, const char 1 * source, size_t num );
- 拷贝num个字符从源字符串到目标空间。
- 如果源字符串的长度小于num,则拷贝完源字符串之后,在目标的后边追加0,直到num个.
#define _CRT_SECURE_NO_WARNINGS
#include <assert.h>
#include <stdio.h>
#include <string.h>int main()
{int num = 0;char str1[200]= "abc";char str2[150]="hello world";printf("请输入源头字符串:>");scanf("%s",str1);printf("请输入要拷贝的字符串:>");scanf("%s",str2);printf("请输入要拷贝的字符个数:>");scanf("%d",&num);printf("拷贝前:>%s\n", str1);strncpy(str1, str2, num);printf("拷贝后:>%s\n", str1);return 0;
}
7.2:strncpy函数的模拟实现
#define _CRT_SECURE_NO_WARNINGS
#include <assert.h>
#include <stdio.h>
#include <string.h>char* my_strncpy(char* str1, const char* str2, size_t num)
{char* result = str1;//防止空字符串assert(str1);assert(str2);//拷贝字符串while (num--){*str1 = *str2;str1++;str2++;}return result;
}int main()
{int num = 0;char str1[200] = "abc";char str2[150] = "hello world";printf("请输入源头字符串:>");scanf("%s", str1);printf("请输入要拷贝的字符串:>");scanf("%s", str2);printf("请输入要拷贝的字符个数:>");scanf("%d", &num);printf("拷贝前:>%s\n", str1);my_strncpy(str1, str2, num);printf("拷贝后:>%s\n", str1);return 0;
}
8.:strncat函数的使用与模拟实现
8.1:strncat函数的使用
比较str1和str2的前num个字符,如果相等就继续往后比较,最多比较num个字⺟,如果提前发现不一样,就提前结束,大的字符所在的字符串大于另外一个。如果num个字符都相等,就是相等返回0.
#define _CRT_SECURE_NO_WARNINGS
#include <assert.h>
#include <stdio.h>
#include <string.h> int main()
{int num = 0;char str1[200]= "abc";char str2[150]="hello world";printf("请输入源头字符串:>");scanf("%s",str1);printf("请输入要追加的字符串:>"); scanf("%s",str2);printf("请输入要追加的字符个数:>");scanf("%d",&num);printf("追加前:>%s\n", str1);strncat(str1, str2, num);printf("追加后:>%s\n", str1);return 0;
}
8.2:strncat的模拟实现
#define _CRT_SECURE_NO_WARNINGS
#include <assert.h>
#include <stdio.h>
#include <string.h>
char * my_strncat(char * str1,const char * str2,size_t num)
{char* result = str1;//防止空字符串assert(str1);assert(str2);while(num--){*str1 = *str2;str1++;str2++;}return str1;
}int main()
{int num = 0;char str1[200]= "abc";char str2[150]="hello world";printf("请输入源头字符串:>");scanf("%s",str1);printf("请输入要追加的字符串:>"); scanf("%s",str2);printf("请输入要追加的字符个数:>");scanf("%d",&num);printf("追加前:>%s\n", str1);strncat(str1, str2, num);printf("追加后:>%s\n", str1);return 0;
}
9.strncmp函数的使用与模拟实现
9.1:strncmp函数的使用
int main()
{int num = 0;char str1[200]= "abc";char str2[150]="hello world";printf("请输入源头字符串:>");scanf("%s",str1);printf("请输入要比较的字符串:>"); scanf("%s",str2);printf("请输入要比较的字符个数:>");scanf("%d",&num);size_t result = strncmp(str1, str2, num);if(result > 0){printf("str1 > str2\n");}else if( result == 0){printf("str1与str2的前num个字符相等\n");}else{printf("str1 < str2\n");}return 0;
}
9.2:strncmp函数的模拟实现
#define _CRT_SECURE_NO_WARNINGS
#include <assert.h>
#include <stdio.h>
#include <string.h>
int my_strncmp(const char* str1, const char* str2, size_t num)
{//防止空字符串assert(str1);assert(str2);while (num != 0 && (*str1 == *str2)){/*确认当循环退出时(即*str1和*str2不再相等)如果* str1 是 '\0',则说明 str1 和 str2 是相等的,因为它们都到达了结束符*/if (*str1 == '\0')return 0;str1++;str2++;num--;}return *str1 - *str2;
}int main()
{int num = 0;char str1[200] = "abc";char str2[150] = "hello world";printf("请输入源头字符串:>");scanf("%s", str1);printf("请输入要比较的字符串:>");scanf("%s", str2);printf("请输入要比较的字符个数:>");scanf("%d", &num);size_t result = strncmp(str1, str2, num);if (result > 0){printf("str1 > str2\n");}else if (result == 0){printf("str1与str2的前num个字符相等\n");}else{printf("str1 < str2\n");}return 0;
}
10:strstr的使用与模拟实现
char * strstr(const char*,const char *);
strstr函数用户匹配字符串,用于匹配str2是否是str1的子串,如果是,那么则会返回子串的首字符在str1的首字符地址.
10.1:strstr的使用
#define _CRT_SECURE_NO_WARNINGS
#include <assert.h>
#include <stdio.h>
#include <string.h> int main()
{int num = 0;char str1[200]= "abc";char str2[150]="hello world";printf("请输入源头字符串:>");scanf("%s",str1);printf("请输入子串:>"); scanf("%s",str2);char* result = strstr(str1, str2);if(result != NULL){printf("%s\n", result);}else{printf("无法匹配到\n");}return 0;
}
10.2:strstr的模拟实现
#define _CRT_SECURE_NO_WARNINGS
#include <assert.h>
#include <stdio.h>
#include <string.h>
const char * my_strstr(const char * str1,const char * str2)
{assert(str1);assert(str2);//用于遍历字符串const char* begin1 = str1;const char* begin2 = str2;//记录起始位置const char* temp = str1;const char* result = str2;while (*begin1 != '\0'){//相等直接越过,while(*begin1 == *begin2){begin1++;begin2++;if(*begin2 == '\0'){return temp;}}//走到这里说明不匹配,那么起始位置++temp++;//源头字符串++begin1 = temp;//匹配字符串回到起始位置begin2 = str2;}return NULL;
}int main()
{int num = 0;char str1[200]= "abc";char str2[150]="hello world";printf("请输入源头字符串:>");scanf("%s",str1);printf("请输入子串:>"); scanf("%s",str2);const char* result = my_strstr(str1, str2);if(result != NULL){printf("%s\n", result);}else{printf("无法匹配到\n");}return 0;
}
11:strtok函数的使用
char * strtok(char * str,const char * sep);
- sep参数指向⼀个字符串,定义了用作分隔符的字符集合.
- 第⼀个参数指定⼀个字符串,它包含了0个或者多个由sep字符串中⼀个或者多个分隔符分割的标记。
- strtok函数找到str中的下⼀个标记,并将其用\0 结尾,返回⼀个指向这个标记的指针.(注:strtok函数会改变被操作的字符串,所以在使用strtok函数切分的字符串⼀般都是临时拷贝的内容并且可修改)
- strtok函数的第⼀个参数不为 NULL,函数将找到str中第⼀个标记,strtok函数将保存它在字符串中的位置。
- strtok函数的第⼀个参数为 NULL,函数将在同⼀个字符串中被保存的位置开始,查找下⼀个标记。
- 如果字符串中不存在更多的标记,则返回 NULL 指针。
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <string.h>
int main()
{char arr[] = "192.168.6.111";const char* sep = ".";char* str = NULL;for (str = strtok(arr, sep); str != NULL; str = strtok(NULL, sep)){printf("%s\n", str);}return 0;
}
12:strerror函数的使用
char * strerror ( int errnum );
strerror函数可以把参数部分错误码对应的错误信息的字符串地址返回来。在不同的系统和C语言标准库的实现中都规定了⼀些错误码,⼀般是放在 errno.h 这个头⽂件中说明的,C语言程序启动的时候就会使用⼀个全⾯的变量errno来记录程序的当前错误码,只不过程序启动的时候errno是0,表示没有错误,当我们在使⽤标准库中的函数的时候发⽣了某种错误,就会讲对应的错误码,存放在errno中,而⼀个错误码的数字是整数很难理解是什么意思,所以每⼀个错误码都是.有对应的错误信息的。strerror函数就可以将错误对应的错误信息字符串的地址返回.
#include <errno.h>
#include <string.h>
#include <stdio.h>
//我们打印⼀下0~10这些错误码对应的信息
int main()
{int i = 0;for (i = 0; i <= 10; i++) {printf("%s\n", strerror(i));}return 0;
}
好啦,uu们,字符函数与字符串函数这部分滴详细知识博主就讲到这里啦,如果uu们觉得博主讲的不错的话,请动动你们滴小手给博主点点赞,你们滴鼓励将成为博主源源不断滴动力,同时也欢迎大家来指正博主滴错误~.
相关文章:

超级字符串技能:提升你的编码游戏
嘿嘿,uu们,今天咱们来详解字符函数与字符串函数,好啦,废话不多讲,开干! 1.:字符分类函数 C语言中又一系列的函数是专门做字符分类的,也就是一个字符属于什么类型的字符的,这些函数的使用需要包含头文件ctype.h 这些函数的使用方法都十分类似,博主在这里就举两到三个…...

米联客-FPGA程序设计Verilog语法入门篇连载-16 Verilog语法_时钟分频设计
软件版本:无 操作系统:WIN10 64bit 硬件平台:适用所有系列FPGA 板卡获取平台:https://milianke.tmall.com/ 登录“米联客”FPGA社区 http://www.uisrc.com 视频课程、答疑解惑! 1概述 本小节讲解Verilog语法的时钟…...

【Echarts】custom自定义图表实现甘特图
效果图 主要注意点: 1、右上角图例visualMap实现 2、visualMap增加formatter 3、series使用custom自定义图表,encode解析四维数组。核心是renderItem方法,必填项,且需要注意要全部定义在options里面!!&…...

【高等代数笔记】003线性方程组的解法(一)
1. 线性方程组的解法 1.1 解线性方程组的矩阵消元法 【例1】解线性方程组 { x 1 3 x 2 x 3 2 3 x 1 4 x 2 2 x 3 9 − x 1 − 5 x 2 4 x 3 10 2 x 1 7 x 2 x 3 1 \left\{\begin{array}{ll} x_{1}3x_{2}x_{3}2 \\ 3x_{1}4x_{2}2x_{3}9 \\ -x_{1}-5x_{2}4x_{3}10 \\…...

Scrapy入门教程
Scrapy入门教程:打造高效爬虫的第一步 1. 引言 在当今的网络世界中,信息是无价的资源。而爬虫工具则是获取这些资源的有力武器。Scrapy 是 Python 生态系统中最强大的爬虫框架之一,它不仅功能强大,而且易于扩展,适用…...

Microsoft VBA Excel VBA学习笔记——双重筛选+复制数值1.0
问题场景 CountryProductCLASS 1CLASS 2CLASS 3CLASS 4CLASS 5CLASS 6…USApple0.3641416030.8918210610.0591451990.7320110290.0509636560.222464259…USBanana0.2300833330.4027262180.1548836670.2988904860.7802326210.028592635…CNApple0.7762370470.5075548320.481978…...

谷歌反垄断官司败诉后,或又面临被拆分风险?
KlipC报道:上周8月5日,美国法院裁定谷歌的搜索业务违反了美国反垄断法,非法垄断在线搜索和搜索文本广告市场。据悉,胜诉的美国司法部正在考虑拆分谷歌。其他选项包括强制谷歌与竞争对手分享更多数据,以及防止其在人工智…...

数据结构入门——06树
1.树 树(Tree)非线性数据结构,它是n(n≥0)个节点的有限集合,它满足两个条件 : 有且仅有一个特定的称为根(Root)的节点; 其余的节点可以分为m(m…...

FFmpeg源码:av_packet_move_ref、av_packet_make_refcounted函数分析
一、av_packet_move_ref函数 (一)av_packet_move_ref函数的声明 av_packet_move_ref函数声明在FFmpeg源码(本文演示用的FFmpeg源码版本为7.0.1)的头文件libavcodec/packet.h中: /*** Move every field in src to ds…...

12 中断
12 中断 1、内核中断编程2、顶半部和底半部机制2.1 任务的相关概念2.1.1 分类2.1.2 优先级2.1.3 进程调度2.1.4 休眠sleep 2.2 顶半部和底半部实现机制2.2.1 顶半部特点2.2.2 底半部特点2.2.3 底半部实现方法之:tasklet2.2.4 底半部实现机制之工作队列2.2.5 底半部实现机制之软…...

经典算法题总结:十大排序算法,外部排序和Google排序简介
十大排序算法 就地性:顾名思义,原地排序通过在原数组上直接操作实现排序,无须借助额外的辅助数组,从而节省内存。通常情况下,原地排序的数据搬运操作较少,运行速度也更快。 稳定性:稳定排序在完…...

服务器是什么?怎么选择适合自己的服务器?
在这个数字化的世界中,我们每天都在与各种网站打交道,浏览新闻、购物、看视频等。你是否曾经好奇过,这些网站是如何运行的?它们又是如何实现随时随地可访问的呢? 在这背后,有一个神秘的角色在默默地支撑着…...

区块链技术的应用场景
区块链技术是一种分布式数据库或公共分类账的形式,它保证了数据的完整性和透明性。它最初是为了支持比特币这种加密货币而被发明的,但现在已经被广泛应用于多种领域,包括供应链管理、投票系统、数字身份验证等。 基本概念 区块 (Block) 区块…...

凤凰端子音频矩阵应用领域
凤凰端子音频矩阵,作为一种集成了凤凰端子接口的音频矩阵设备,具有广泛的应用领域。以下是其主要应用领域: 一、专业音响系统 会议系统:在会议室中,凤凰端子音频矩阵能够处理多个话筒和音频源的信号,实现…...

LeetCode-字母异位词分组
题目描述 给你一个字符串数组,请你将 字母异位词 组合在一起。可以按任意顺序返回结果列表。 字母异位词 是由重新排列源单词的所有字母得到的一个新单词。 示例 1: 输入: strs ["eat", "tea", "tan", "ate", "na…...

《Linux运维总结:基于x86_64架构CPU使用docker-compose一键离线部署etcd 3.5.15容器版分布式集群》
总结:整理不易,如果对你有帮助,可否点赞关注一下? 更多详细内容请参考:《Linux运维篇:Linux系统运维指南》 一、部署背景 由于业务系统的特殊性,我们需要面对不同的客户部署业务系统࿰…...

WPF动画
补间动画:动画本质就是在一个时间段内对象尺寸、位移、旋转角度、缩放、颜色、透明度等属性值的连续变化。也包括图形变形的属性。时间、变化的对象、变化的值 工业应用场景:蚂蚁线、旋转、高度变化、指针偏移、小车 WPF动画与分类 特定对象处理动画过…...

大数据系列之:统计hive表的详细信息,生成csv统计表
大数据系列之:统计hive表的详细信息,生成csv统计表 一、获取源数据库、源数据库类型、hive数据库名称二、获取hive数据库名、hive表名、数仓层级、空间、维护者信息三、统计hive表信息四、统计源库信息五、合并hive表信息六、生成csv统计表七、完整代码一、获取源数据库、源数…...

flutter 画转盘
import package:flutter/material.dart; import dart:math;const double spacingAngle 45.0; // 每两个文字之间的角度 // 自定义绘制器,ArcTextPainter 用于在圆弧上绘制文字 class ArcTextPainter extends CustomPainter {final double rotationAngle; // 动画旋…...

图像识别,图片线条检测
import cv2 import numpy as np # 读取图片 img cv2.imread(1.png)# 灰度化 gray cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)# 边缘检测 edges cv2.Canny(gray, 100, 200) 当某个像素点的梯度强度低于 threshold1 时,该像素点被认为是非边缘;当梯度强度…...

python crawler web page
npm install or pip install 插件 import json import time from openpyxl import load_workbook from pip._vendor import requests from bs4 import BeautifulSoup import pandas as pd import re import xlsxwriter 設置request header header {user-agent: Mozilla/5.0…...

基于QT实现的TCP连接的网络通信(客户端)
上篇介绍了QT实现网络通信的服务器端,还没看服务器的朋友们先去上篇了解,这篇我来实现一下客户端的实现。 首先还是新建一个项目 选择mainwindow类 在通信前将.pro文件的第一行代码中追加network 窗口搭建 在mainwindow.ui中完成一下窗口的搭建 首先在…...

Vue2中watch与Vue3中watch对比
上一节说到了 computed计算属性对比 ,虽然计算属性在大多数情况下更合适,但有时也需要一个自定义的侦听器。这就是为什么 Vue 通过 watch 选项提供了一个更通用的方法,来响应数据的变化。当需要在数据变化时执行异步或开销较大的操作时&#…...

Web 3 一些常见术语
目录 Provider 提供者Signer 签名者Transaction 交易Contract 合约Receipt 收据 首先,从高层次上对可用对象的类型及其负责的内容有一个基本的了解是很有用的。 Provider 提供者 一个 Provider 是与区块链的只读连接,允许查询区块链状态,例…...

揭开数据分析中的规范性分析:从入门到精通
目录 引言1. 规范性分析的基本概念2. 规范性分析的方法论2.1 线性规划:资源利用最大化2.2 决策树分析:直观的选择路径2.3 贝叶斯网络:应对不确定性的利器2.4 多目标优化:平衡多重目标的艺术 3. 规范性分析的实际应用3.1 商业决策中…...

Linux文件IO
目录 前言 一.文件操作 系统调用接口 1.打开文件 2.关闭文件 3.读取文件 4.写入文件 二.文件描述符 重定向 三.动静态库 前言 在Linux操作系统中,文件I/O是一个核心概念,涉及如何读写文件、与设备通信以及如何管理数据流。Linux下一切皆文件, …...

ccfcsp-202309(1、2、3)
202309-1 坐标变换(其一) #include <bits/stdc.h> using namespace std; int main() {ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);int n, m;cin >> n >> m;int x, y;int opx 0, opy 0;for(int i 0; i < n; i){cin &g…...

数据结构--数据结构概述
一、数据结构三要素 1. 数据的逻辑结构 数据的逻辑结构是指数据元素之间的关系和组织方式,通常分为线性结构和非线性结构。 线性结构:例如线性表,其中数据元素按照顺序排列,彼此之间存在一对一的关系。 非线性结构:…...

Spring中的BeanFactoryAware
BeanFactoryAware 是 Spring 框架中的一个接口,用于在 Spring 容器中获取 BeanFactory 实例。实现这个接口的类可以在其属性被设置后获取到 BeanFactory,从而可以访问 Spring 容器中的其他 bean。 BeanFactoryAware 接口概述 BeanFactoryAware 接口位于…...

Neo4j service is not installed
问题: Starting Neo4j. Neo4j service is not installed Unable to start. See user log for details. Run with --verbose for a more detailed error message.解决: neo4j windows-service install neo4j start ok了...