
C/C++
C/C++
未名编程
编程爱好者,诗词达人
展开
-
$文本串加密和解密程序
#include <iostream>using namespace std;#define MaxSize 50typedef char ElemType;typedef struct { char data[MaxSize]; int length;} SqString;SqString sqStr, matchStr;void create(SqString &s, char cstr[]) { int i = 0; for (i = 0; cstr[i]原创 2020-09-04 18:05:05 · 149 阅读 · 0 评论 -
$停车场管理系统 栈与队列
#include<iostream>#include<iomanip>#include<malloc.h>using namespace std;#define Max 3 //停车场容量#define Price 0.10 //收费价格#define ERROR -1typedef struct { int hour; int min;} Time;typedef struct Node { char num[20]原创 2020-09-04 18:04:59 · 98 阅读 · 0 评论 -
$求两个对称矩阵之和与乘积
#include <stdio.h>#define X 3#define Y 6static int value(int a[], int i, int j){if(i >= j) return a[(i * (i + 1)) / 2 + j]; //下三角 else return a[(j * (j + 1)) / 2 + i]; //上三角 }static void add(int a[], int b[], int c原创 2020-09-04 18:04:52 · 182 阅读 · 0 评论 -
C语言实现2048游戏(Windows版)
〇、前言 本文最初是在2014年发表的,当时只是Windows版本的,前段时间有位读者给我发邮件咨询Linux下版本移植问题,于是便花时间支持了Linux下的版本,并修改完善了代码,加入记录最高分的功能,供读者参考学习。一、游戏介绍 所谓《2048》是最近比较流行的一款数字游戏。原版2048首先在github上发布,原作者是Gabriele Cirulli。它是基于《1024》和《小3传奇》(Threes!)的玩法开发而成的新型数字游戏。二、游戏规则 游戏的规则很简单,你需要控制所有方块向同一原创 2020-11-24 11:10:28 · 9041 阅读 · 6 评论 -
C语言实现2048小游戏---粤嵌GE6818嵌入式系统实训
C语言实现2048小游戏---粤嵌GE6818嵌入式系统实训原创 2020-11-17 23:43:58 · 13513 阅读 · 1 评论 -
#C语言#重定义问题
错误显示在h文件504行处有先前定义的位置,这是因为库文件里已经存在这个变量了,再于头文件定义该变量就会报错,解决方法就是注释掉头文件对该变量的定义。原创 2020-11-14 09:38:56 · 1844 阅读 · 0 评论 -
#C语言#警告:隐式声明函数‘xxx’ [-Wimplicit-function-declaration]
C语言编译时报错:警告:隐式声明函数‘xxx’ [-Wimplicit-function-declaration]加下对应函数的头文件就好。比如 隐式声明函数‘time’ [-Wimplicit-function-declaration]Linux命令行man 2 time,找到time函数用到的头文件加上就ok了#include<time.h>...原创 2020-11-24 10:34:45 · 2995 阅读 · 1 评论 -
粤嵌GE6818实现识别触摸坐标的识别
// main.c#include "lcd.h"#include "bmp.h"int *p = NULL;int main(){ init();//打开帧缓冲 映射 //show_bmp("./1.bmp",0,0); get_xy(); end();//关闭帧缓冲设备文件 解除映射}// lcd.c#include "lcd.h"int fd = 0;void init() { fd = open("/dev/fb0",O_RDWR); if(fd==-1)原创 2020-11-24 10:34:12 · 6866 阅读 · 1 评论 -
模块化思想——粤嵌GEC6818读取图片宽度、高度、色深
模块化思想交叉编译两个c文件的方法:模块化思想:。。。只有一个唯一的main函数‘一个或者多个功能函数 main.clcd.c lcd.hbmp.c bmp.hled.c led.hbeef.c beef.h......h怎么写? 例:led.h#ifndef __LED_H__#define __LED_H__// 变量的定义 // 函数的声明//。。。#endif功能函数: 封装一个函数 /* 功能函数:对一.原创 2020-11-24 10:35:48 · 1719 阅读 · 0 评论 -
粤嵌GEC6818实现图片显示
#include <sys/types.h>#include <sys/stat.h>#include <fcntl.h>#include <unistd.h>#include <stdio.h>#include <sys/mman.h>#include <math.h>#include <stdlib.h>int * p = NULL ;void draw_point(int x,int .原创 2020-11-24 10:43:21 · 22600 阅读 · 2 评论 -
Linux交叉编译+粤嵌LCD实现三色图
#include <stdio.h>#include <sys/types.h>#include <sys/stat.h>#include <fcntl.h>#include <unistd.h>#include <sys/mman.h>int main(){ int fd = open("/dev/fb0",O_RDWR); int *p = mmap(NULL,800*480*4,PROT_READ | P.原创 2020-11-24 10:32:17 · 10697 阅读 · 0 评论