这些代码是我为了一个朋友创作的,花了5个晚上完工的,说实话一开始我对于C语言的理解仅仅停留在解一些书本上的题,但是将编程融入生活中去你会发现许多奇妙的东西,就像在写这个代码的时候,我学到了许多在课堂上学不到的只是,该到正题了,对于这个代码我准备了以下几个步骤。
- 先搜索优快云里前辈们写的泡妞撩妹代码摘其精要,然后对于自己的代码有个大概的构思;
2.然后开始着手写代码了,我的能力有限,所以我先将我的思路分成三个小模块,类似于我这样水平低的小伙伴可以学下我的方法,我觉得挺好的,这样如果出错也只用检查一下部分,而不是全部大改;
2.然后开始着手写代码了,我的能力有限,所以我先将我的思路分成三个小模块,类似于我这样水平低的小伙伴可以学下我的方法,我觉得挺好的,这样如果出错也只用检查一下部分,而不是全部大改;
3.当然过程不是一帆风顺的,在前奏的音乐部分我差不多浏览了10多篇博文才看中这个的,你们可能以为搜到博文就能弄了就大错特错,如果看不懂你是无法将这些代码整合的,一旦强行拼凑你会发现一堆报错,主题部分的代码是我差不多也是浏览了10多篇博文相中的,最后的小蛋糕是我自己写的比较简陋,如果大家有啥好的想法一起分享哦!
就是吐槽下,为啥这些人在优快云上发作品都不加注释的么我都快看吐了**!!!**
C语言
#include<stdio.h>
#include<iostream>
#include <windows.h>
#include<string>
#include<math.h>
#include<stdlib.h>
using namespace std;
#define N 10 //产生随机颜色
#define Time 202004270 //延时器
//________________________________________________________________________________________________________________
//定义低音
const int A1 = 131;
const int A2 = 147;
const int A3 = 165;
const int A4 = 175;
const int A5 = 196;
const int A6 = 220;
const int A7 = 247;
//定义中音
const int B1 = 262;
const int B2 = 296;
const int B3 = 330;
const int B4 = 349;
const int B5 = 392;
const int B6 = 440;
const int B7 = 494;
//定义高音
const int C1 = 523;
const int C2 = 587;
const int C3 = 659;
const int C4 = 698;
const int C5 = 784;
const int C6 = 880;
const int C7 = 988;
//定义高二度
const int D1 = 1047;
const int D2 = 1175;
const int D3 = 1319;
const int D4 = 1397;
const int D5 = 1568;
const int D6 = 1760;
const int D7 = 1976;
//定义节拍
const int OneBeat = 600;
const int HalfBeat = 300;
//___________________________________________________________
char randk()