- 博客(8)
- 收藏
- 关注
原创 内联函数---函数重载---函数缺省
//内联函数 //函数调用是有时间开销的。如果函数本身只有几条语句,执行非常快,而且函数被反复执行很多次, 相比之下调用函数所产生的这个开销就会显得比较大 //为了减少函数调用的开销,引入了内联函数机制。编译器处理对内联函数的调用语句时,是将整个函数的代码插入到调用语句处, 而不会产生调用函数的语句。#include<stdio.h>inline int Max(int a, int b){ if (a < b)a = b; return b;...
2022-03-12 17:54:42
478
原创 面向对象cout cin 引用以及const
#include <iostream>////函数重载(同名 不同参数)//int compare(int a, int b);//int compare(float a, float b);////using namespace std;//int main()//{// int number;// // cout << "!!!hello world!!!"<<18<<" today" << endl;...
2022-03-12 17:51:40
553
原创 飞翔的小鸟
#include"game.h"IMAGE background;IMAGE OVER_BACK[2];IMAGE bird[2];IMAGE POLL[3];IMAGE down[2];IMAGE UP[2];struct poll{ int x; int y; int height; int speed; int w, h;};//对柱子的结构体进行初始化//试图让整个地图动起来//初步的想法是//1.想让地图的横坐标想左移动通...
2022-02-09 19:33:08
348
原创 C++实现图像和声音的方法
以上方法先将字符集改成多字符集我用的是vs2022;首先咱们先说播放音乐的事情1准备好要播放的音乐(下载好的,网易云的不行,可以在网上找一些MP3的音乐尝试一下)将音乐源文件放到你的项目文件下*************记住一定是项目文件我用的方法是MCISENDSTRING函数库函数#include<mmsystem.h>#pragma comment(lib,"winmm.lib")常用的参数就是{ 1.open---------...
2022-02-08 16:36:42
1394
原创 c++显示图片的方法
#include<iostream>#include<graphics.h>//图形库#include<conio.h>//解决光标的闪烁的问题#include"resource.h";//在引用图片的时候可以添加一个这样的库#include<ColorDlg.h>int main(){ initgraph(600,600);//建立画布大小 IMAGE MM;//IMAGE 用来给图片命名//这里主要想给大家推荐的是用资源文...
2022-02-08 00:45:56
10981
2
原创 扫雷小游戏
game.c#include"game.h"//初始化棋盘int InitBoard(char Board[ROWS][COLS], int row, int col , char str){ int i, j; for (i = 0; i <= row + 1; i++) { for (j = 0; j <= col + 1; j++) { Board[i][j] = str; }...
2022-02-07 19:37:49
2125
原创 判断了两个日期之间的天数
**判断了两个日期之间的天数**#include<stdio.h>#define Ipmaire(year) ((year%40)&&(year%100!=0)||year%4000)///很少使用define宏,格式要记住可以当个函数使用感觉struct date{int year;int day;int month;};int datediff(struct date minday, struct date maxday);int main(void
2022-02-04 20:37:28
293
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人