摘要: 开源代码,希望大家多多支持。 期望吸纳更多优秀意见,共同进步。 QQ:3073309211 DEV可直接运行 话不多说直接上代码(点赞!点赞!点赞!) 参考文件:(17条消息) 贪吃蛇(C语言实现)_2021dragon的博客-CSDN博客_c语言贪吃蛇 #include <stdio.h> #in 阅读全文
posted @ 2022-05-18 18:49 xxj112 阅读(84) 评论(0) 推荐(0)
摘要: 打开文件关闭文件 文件分为:二进制(dat)和文本文件(txt); 代码: #include<stdio.h> #include<stdlib.h> { FILE *fp; if ((fp=fopen("地址&名字","方式"))==NULL) { printf("cannot open file\ 阅读全文
posted @ 2022-05-09 18:48 xxj112 阅读(48) 评论(0) 推荐(0)
摘要: 原理: 都是基于二分查找。 升序数组中: lower_bound( begin,end,num):返回(begin和end之间)第一个大于或等于num的数字的地址。 下标=返回地址-begin; upper_bound(begin,end,num) : (同上) 唯一不同——返回第一个大于num的数 阅读全文
posted @ 2022-05-09 17:55 xxj112 阅读(47) 评论(0) 推荐(0)
摘要: fill 在头文件<algorithm>里。 按照数组的始末位置以一个数组元素为单位赋值,将区间内的每一个元素都赋值为val。 代码:fill(vector.begin(), vector.end(), val); fill_n() 在头文件<algorithm>里。 从当前起始点开始,将之后的cn 阅读全文
posted @ 2022-05-09 17:40 xxj112 阅读(100) 评论(0) 推荐(0)
摘要: #include<iostream> #include<queue> #include<vector> using namespace std; typedef pair<int,int> pll; int main() { priority_queue<pll,vector<pll>,less<p 阅读全文
posted @ 2022-05-09 17:22 xxj112 阅读(27) 评论(0) 推荐(0)
摘要: #include <cstdio> #include <windows.h> #include <conio.h> char a[20][20]={"##########", "## ###", "##O### #", "# S O O #", "# **# O ##", "##**# ##", " 阅读全文
posted @ 2022-05-06 16:11 xxj112 阅读(89) 评论(0) 推荐(0)
摘要: #include<stdio.h> #include<string.h> int main() { char a[100],b[100],t[100]; gets(a); gets(b); char *p; int w=strlen(a); while((p=strstr(a,b))!=NULL) 阅读全文
posted @ 2022-05-05 15:40 xxj112 阅读(38) 评论(0) 推荐(0)
摘要: #include<stdio.h> #include<string.h> //int gcd(int a,int b) //较快 //{ // return b>0?gcd(b,a%b):a; //} int gcd(int a,int b) //超快 { // if(b) // while((a% 阅读全文
posted @ 2022-05-05 15:22 xxj112 阅读(69) 评论(0) 推荐(0)
摘要: #include<bits/stdc++.h> #include<vector> using namespace std; vector<int> G[666]; int e[630]; int main() { int n,m,a,b; while(~scanf("%d %d",&n,&m)) { 阅读全文
posted @ 2022-05-03 21:43 xxj112 阅读(21) 评论(0) 推荐(0)
摘要: 数组做参数,可以改变实参。相当于把地址给函数。 静态储存变量:只赋值一次。 ( static 类型名 变量 ) extern 动态函数 static静态函数 阅读全文
posted @ 2022-04-28 18:55 xxj112 阅读(25) 评论(0) 推荐(0)