情人节特别篇:用c++弹奏音乐“海阔天空”与“孤勇者”

这篇具有很好参考价值的文章主要介绍了情人节特别篇:用c++弹奏音乐“海阔天空”与“孤勇者”。希望对大家有所帮助。如果存在错误或未考虑完全的地方,请大家不吝赐教,您也可以点击"举报违法"按钮提交疑问。

情人节特别篇:用c++弹奏音乐“海阔天空”与“孤勇者”,c++,开发语言,数据结构

W...Y的主页 💕

代码库分享 😊


目录

孤勇者

海阔天空


今天是2023年8月22日七夕情人节,但是对我来说就是再普通不过的日子。我相信有很多人期待这一天的到来,和自己的对象出去享受快乐时光。但是我只有一个人独孤的度过短暂的时光,我相信一定有兄弟与我处境相同。

孤勇者

不要悲伤,不要哭泣,快乐的日子终会来临!!!

送给大家一首用c++写的孤勇者,让大家在今天都可以快乐度过!

注意:使用vs、devc++等编译器均可执行代码,只需要创建一个源文件即可。

#define _CRT_SECURE_NO_WARNINGS 1
#include <iostream>
#include <Windows.h>

#pragma comment(lib,"winmm.lib")

using namespace std;

enum Scale

{

    Rest = 0, C8 = 108, B7 = 107, A7s = 106, A7 = 105, G7s = 104, G7 = 103, F7s = 102, F7 = 101, E7 = 100,

    D7s = 99, D7 = 98, C7s = 97, C7 = 96, B6 = 95, A6s = 94, A6 = 93, G6s = 92, G6 = 91, F6s = 90, F6 = 89,

    E6 = 88, D6s = 87, D6 = 86, C6s = 85, C6 = 84, B5 = 83, A5s = 82, A5 = 81, G5s = 80, G5 = 79, F5s = 78,

    F5 = 77, E5 = 76, D5s = 75, D5 = 74, C5s = 73, C5 = 72, B4 = 71, A4s = 70, A4 = 69, G4s = 68, G4 = 67,

    F4s = 66, F4 = 65, E4 = 64, D4s = 63, D4 = 62, C4s = 61, C4 = 60, B3 = 59, A3s = 58, A3 = 57, G3s = 56,

    G3 = 55, F3s = 54, F3 = 53, E3 = 52, D3s = 51, D3 = 50, C3s = 49, C3 = 48, B2 = 47, A2s = 46, A2 = 45,

    G2s = 44, G2 = 43, F2s = 42, F2 = 41, E2 = 40, D2s = 39, D2 = 38, C2s = 37, C2 = 36, B1 = 35, A1s = 34,

    A1 = 33, G1s = 32, G1 = 31, F1s = 30, F1 = 29, E1 = 28, D1s = 27, D1 = 26, C1s = 25, C1 = 24, B0 = 23,

    A0s = 22, A0 = 21

};

enum Voice

{

    X1 = C2, X2 = D2, X3 = E2, X4 = F2, X5 = G2, X6 = A2, X7 = B2,

    L1 = C3, L2 = D3, L3 = E3, L4 = F3, L5 = G3, L6 = A3, L7 = B3,

    M1 = C4, M2 = D4, M3 = E4, M4 = F4, M5 = G4, M6 = A4, M7 = B4,

    H1 = C5, H2 = D5, H3 = E5, H4 = F5, H5 = G5, H6 = A5, H7 = B5,

    LOW_SPEED = 500, MIDDLE_SPEED = 400, HIGH_SPEED = 300,

    _ = 0XFF

};

// 孤勇者
void GYZ()

{

    HMIDIOUT handle;
    midiOutOpen(&handle, 0, 0, 0, CALLBACK_NULL);

    int volume = 0x7f;
    int voice = 0x0;
    int sleep = 350;
    int gyz[] =
    {

       M2,L7,M1,L6,M2,L7,M1,L6,M2,L7,M1,L6,M2,L7,M1,L6,M2,L7,M1,L6,M2,L7,M1,L6,M2,L7,M1,L6,M2,L7,M1,L6,M2,L7,M1,L6,M2,L7,M1,L6,

       M3,_,_,_,_,_,0,700,M1,M2,M1,300,M3,_,_,_,_,700,0,M1,M2,M1,M2,M3,300,L6,700,0,M1,300,L6,700,0,M1,300,L6,700,0,M1,300,M2,M1,L7,_,_,_,_,_,_,_,

       M3,_,_,_,_,_,0,700,M1,M2,M1,300,M3,_,_,_,_,700,0,M1,M2,M1,M2,M3,300,L6,700,0,M1,300,L6,700,0,M1,300,L6,700,0,M1,300,M3,M2,L7,_,_,_,_,_,_,_,

       0,L6,M1,300,M6,0,700,M6,M6,M5,300,M6,0,M6,M5,M6,M5,M6,M5,700,300,M3,700,_,_,_,_,_,0,L6,M1,300,M6,0,M6,M6,M5,M6,M5,300,M7,700,0,M7,M7,M6,300,M7,0,700,300,M6,0,M3,300,_,_,_,_,

      _,0,M3,M5,M3,300,M2,700,0,M3,300,M2,700,0,M3,300,M2,700,0,M3,300,0,M5,M3,M5,M3,300,M2,700,0,M3,300,M2,700,0,M3,300,M2,_,_,0,M1,M2,300,M3,L6,M1,M3,M2,700,0,M3,M2,700,300,M1,L6,_,_,_,_,_,_,

       0,M6,M7,H1,H2,M7,H1,300,H1,0,H1,M7,H1,H2,M7,H1,300,

       H1,0,H1,H2,H3,H2,H3,H2,300,H3,0,H3,H2,300,H3,H5,H3,0,M6,M7,H1,H2,M7,H1,300,

       H1,0,H1,M7,H1,H2,M7,H1,300,H1,0,H1,H2,H3,H2,H3,H2,300,H3,0,H3,H2,300,H3,H5,H3,

       H5,H3,700,0,H5,300,H3,700,0,H5,300,0,H3,H5,H6,H3,300,H5,H5,H3,700,0,H5,300,H3,700,0,H5,H3,H5,H6,H3,300,

       H5,0,H5,H5,H3,700,H2,300,H2,0,H1,H3,_,300,H2,H2,0,H1,300,M6,700,_,_,_,_,_,_,

       0,H5,H5,H3,700,300,H2,H2,0,H1,H3,_,300,H2,H2,0,H1,M6,_,_,_,_,_,_,_,

       _,_,_,_,_,_,_,_, _,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,0,M6,M5,300,M6,700,0,M5,M6,M5,M6,M5,300,M6,0,M6,M5,M6,M5,M6,M5,700,M3,700,M3,_,_,_,_,

       0,M6,M5,300,M6,700,0,M5,M6,M5,M6,M5,300,M7,700,0,M7,M7,M6,M7,M6,700,300,M3,700,_,_,700,0,M3,M5,M3,300,M2,700,0,M3,300,M2,700,0,M3,300,M2,700,0,M3,M5,M3,M5,M3,300,M2,700,0,M3,300,M2,700,0,M3,300,M2,_,_,

       0,M1,M2,300,M3,M6,H1,H3,H2,700,0,H3,300,H2,700,300,H1,M6,_,_,_,_,_,

       0,M6,M7,H1,H2,M7,H1,300,H1,0,H1,M7,H1,H2,M7,H1,300,

       H1,0,H1,H2,H3,H2,H3,H2,300,H3,0,H3,H2,300,H3,H5,H3,0,M6,M7,H1,H2,M7,H1,300,

       H1,0,H1,M7,H1,H2,M7,H1,300,H1,0,H1,H2,H3,H2,H3,H2,300,H3,0,H3,H2,300,H3,H5,H3,

       H5,H3,700,0,H5,300,H3,700,0,H5,300,0,H3,H5,H6,H3,300,H5,H5,H3,700,0,H5,300,H3,700,0,H5,H3,H5,H6,H3,300,

       H5,0,H5,H5,H3,700,H2,300,H2,0,H1,H3,_,300,H2,H2,0,H1,300,M6,700,_,_,_,_,_,_,

       0,H5,H5,H3,700,300,H2,H2,0,H1,H3,_,300,H2,H2,0,H1,M6,_,_,_,_,_,_,_,

       L6,M1,M3,M7,_,M7,0,M7,M7,300,M6,_,_,_,_,_,_,_,_,L6,M1,M3,M7,_,M7,0,M7,M7,300,M6,_,_,_,_,_,_,_,_,

       0,M6,M7,H1,H2,M7,H1,300,H1,0,H1,M7,H1,H2,M7,H1,300,

       H1,0,H1,H2,H3,H2,H3,H2,300,H3,0,H3,H2,300,H3,H5,H3,0,M6,M7,H1,H2,M7,H1,300,

       H1,0,H1,M7,H1,H2,M7,H1,300,H1,0,H1,H2,H3,H2,H3,H2,300,H3,0,H3,H2,300,H3,H5,H3,

       H5,H3,700,0,H5,300,H3,700,0,H5,300,0,H3,H5,H6,H3,300,H5,H5,H3,700,0,H5,300,H3,700,0,H5,H3,H5,H6,H3,300,

       H5,0,H5,H5,H3,700,H2,300,H2,0,H1,H3,_,300,H2,H2,0,H1,300,M6,700,_,_,_,_,_,_,

       0,H5,H5,H3,700,300,H2,H2,0,H1,H3,_,300,H2,H2,0,H1,M6,_,_,_,_,_,_,_,

    };

    for (auto i : gyz) {
        if (i == LOW_SPEED || i == HIGH_SPEED || i == MIDDLE_SPEED) {
            sleep = i;//Sleep(i/2);
            continue;

        }

        if (i == 0) { sleep = 175; continue; }
        if (i == 700) { Sleep(175); continue; }
        if (i == _) {
            Sleep(350);
            continue;
        }
        voice = (volume << 16) + ((i) << 8) + 0x90;
        midiOutShortMsg(handle, voice);
        cout << voice << endl;
        Sleep(sleep);
    }
    midiOutClose(handle);
}
int main(void)
{
    GYZ();
    return 0;
}

孤勇者

都,是勇敢的

你额头的伤口,你的,不同,你犯的错

都,不必隐藏

你破旧的玩偶,你的,面具,你的自我

他们说,要带着光,驯服每一头怪兽

他们说,要缝好你的伤,没有人爱小丑

为何孤独,不可,光荣

人只有不完美,值得歌颂

谁说污泥满身的不算英雄

爱你孤身走暗巷,爱你不跪的模样

爱你对峙过绝望,不肯哭一场

爱你破烂的衣裳,却敢堵命运的枪

爱你和我那么像,缺口都一样

去吗,配吗,这褴褛的披风

战吗,战啊,以最卑微的梦

致那黑夜中的呜咽与怒吼

谁说站在光里的才算英雄

他们说,要戒了你的狂

就像擦掉了污垢

他们说,要顺台阶而上

而代价是低头

那就让我,不可,乘风

你一样骄傲着,那种孤勇

谁说对弈平凡的不算英雄

爱你孤身走暗巷,爱你不跪的模样

爱你对峙过绝望,不肯哭一场

爱你破烂的衣裳,却敢堵命运的枪

爱你和我那么像,缺口都一样

去吗,配吗,这褴褛的披风

战吗,战啊,以最卑微的梦

致那黑夜中的呜咽与怒吼

谁说站在光里的才算英雄

你的斑驳,与众不同

你的沉默,震耳欲聋

You Are The Hero

爱你孤身走暗巷,爱你不跪的模样

爱你对峙过绝望,不肯哭一场

爱你来自于蛮荒,一生不借谁的光

你将造你的城邦,在废墟之上

去吗,去啊,以最卑微的梦

战吗,战啊,以最孤高的梦

致那黑夜中的呜咽与怒吼

谁说站在光里的才算英雄

海阔天空

长风破浪会有时,直挂云帆济沧海,虽然我们这个七夕节没有那么快乐,但是今天一定也会有人在努力提升自己,让自己变得更优秀。

前方的光明在等着大家,就像海阔天空中的一句歌词一样:多少次, 迎着冷眼与嘲笑,从没有放弃过心中的理想。一首海阔天空送给一直在默默努力奋斗的人们,坚持下来一定会成功!!!

#include <iostream>
#include <Windows.h>

#pragma comment(lib,"winmm.lib")

using namespace std;

enum Scale

{

    Rest = 0, C8 = 108, B7 = 107, A7s = 106, A7 = 105, G7s = 104, G7 = 103, F7s = 102, F7 = 101, E7 = 100,

    D7s = 99, D7 = 98, C7s = 97, C7 = 96, B6 = 95, A6s = 94, A6 = 93, G6s = 92, G6 = 91, F6s = 90, F6 = 89,

    E6 = 88, D6s = 87, D6 = 86, C6s = 85, C6 = 84, B5 = 83, A5s = 82, A5 = 81, G5s = 80, G5 = 79, F5s = 78,

    F5 = 77, E5 = 76, D5s = 75, D5 = 74, C5s = 73, C5 = 72, B4 = 71, A4s = 70, A4 = 69, G4s = 68, G4 = 67,

    F4s = 66, F4 = 65, E4 = 64, D4s = 63, D4 = 62, C4s = 61, C4 = 60, B3 = 59, A3s = 58, A3 = 57, G3s = 56,

    G3 = 55, F3s = 54, F3 = 53, E3 = 52, D3s = 51, D3 = 50, C3s = 49, C3 = 48, B2 = 47, A2s = 46, A2 = 45,

    G2s = 44, G2 = 43, F2s = 42, F2 = 41, E2 = 40, D2s = 39, D2 = 38, C2s = 37, C2 = 36, B1 = 35, A1s = 34,

    A1 = 33, G1s = 32, G1 = 31, F1s = 30, F1 = 29, E1 = 28, D1s = 27, D1 = 26, C1s = 25, C1 = 24, B0 = 23,

    A0s = 22, A0 = 21

};

enum Voice

{

    X1 = C2, X2 = D2, X3 = E2, X4 = F2, X5 = G2, X6 = A2, X7 = B2,

    L1 = C3, L2 = D3, L3 = E3, L4 = F3, L5 = G3, L6 = A3, L7 = B3,

    M1 = C4, M2 = D4, M3 = E4, M4 = F4, M5 = G4, M6 = A4, M7 = B4,

    H1 = C5, H2 = D5, H3 = E5, H4 = F5, H5 = G5, H6 = A5, H7 = B5,

    LOW_SPEED = 500, MIDDLE_SPEED = 400, HIGH_SPEED = 300,

    _ = 0XFF

};
void HKTK()

{
    HMIDIOUT handle;
    midiOutOpen(&handle, 0, 0, 0, CALLBACK_NULL);

    int volume = 0x7f;
    int voice = 0x0;
    int sleep = 400; int tmp = 0;
    int hktk[] =

    {
     X4,(H7 - 1),_,H6,_,_,_, H5,H4,H3,H2,_,(L7 - 1),M1,M4,(X7 - 1),_,_,_,_, (L7 - 1),M1,M4,(X7 - 1),_,_,_,_,(L7 - 1),M1,M5,M4,_,_,_,_,_,M4,_,M3,_,_,_,

     1000,M3,0,M2,700,300,M1,_,_,_,_,_,_,0,M3,M4,300,M5,0,M5,M5,300,_,M6,700,M5,_,_,

     0,M6,M7,300,H1,0,H1,300,H1,700,H1,H1,M7,0,M6,300,M5,700,0,M6,300,_,_,_,_,_,

     M6,M5,M5,_,_,M5,M3,_,M3,M4,M3,M2,M2,0,M3,M2,300,_,_,M3,0,M2,M2,_,300,M1,M1,0,M1,M1,300,_,_,M2,M1,M1,_,_,_,_,_,_,

     1000,M3,0,M2,700,300,M1,_,_,_,_,_,_,0,M3,M4,300,M5,0,M5,M5,300,_,M6,700,M5,_,_,

     0,M6,M7,300,H1,0,H1,300,H1,700,H1,H1,M7,0,M6,300,M5,700,0,M6,300,_,_,_,_,_,

     M6,M5,M5,_,_,M5,M3,_,M3,M4,M3,M2,M2,0,M3,M2,300,_,_,M3,0,M2,M2,_,300,M1,M1,0,M1,M1,300,_,_,M2,M1,M1,_,_,_,_,_,_,

     _,0,M6,M7,300,H1,0,H1,H1,_,300,H1,M7,M6,0,M5,300,M5,700,M5,_,0,M3,300,M2,700,M1,_,_,_,_,0,H1,H1,300,H1,0,H1,H2,_,300,H2,0,H1,300,H2,700,H3,_,_,_,H3,0,H2,300,H1,700,

     _,0,H1,H1,300,H1,0,H1,H2,300,_,_,_,0,M5,M5,300,H3,_,H2,_,H1,_,_,_,

     _,0,H1,H1,300,H1,0,H1,H2,300,_,0,H2,H2,H1,300,M7,700,H1,_,_,_,_,_,_,_,

     1000,M3,0,M2,700,300,M1,_,_,_,_,_,_,0,M3,M4,300,M5,0,M5,M5,300,_,M6,700,M5,_,_,

     0,M6,M7,300,H1,0,H1,300,H1,700,H1,H1,M7,0,M6,300,M5,700,0,M6,300,_,_,_,_,_,

     M6,M5,M5,_,_,M5,M3,_,M3,M4,M3,M2,M2,0,M3,M2,300,_,_,M3,0,M2,M2,_,300,M1,M1,0,M1,M1,300,_,_,M2,M1,M1,_,_,_,_,_,_,

     _,0,M6,M7,300,H1,0,H1,H1,_,300,H1,M7,M6,0,M5,300,M5,700,M5,_,0,M3,300,M2,700,M1,_,_,_,_,0,H1,H1,300,H1,0,H1,H2,_,300,H2,0,H1,300,H2,700,H3,_,_,_,H3,0,H2,300,H1,700,

     _,0,H1,H1,300,H1,0,H1,H2,300,_,_,_,0,M5,M5,300,H3,_,H2,_,H1,_,_,_,

     _,0,H1,H1,300,H1,0,H1,H2,300,_,0,H2,H2,H1,300,M7,700,H1,_,_,_,_,_,_,_,

     M6,M6,M7,M6,M7,H1,_,_,_,0,H1,H1,300,H2,H1,H2,H3,_,_,_,H3,H2,_,_,0,H2,H3,300,H1,_,_,_,_,_,

     _,0,M6,M7,300,H1,0,H1,H1,_,300,H1,M7,M6,0,M5,300,M5,700,M5,_,0,M3,300,M2,700,M1,_,_,_,_,0,H1,H1,300,H1,0,H1,H2,_,300,H2,0,H1,300,H2,700,H3,_,_,_,H3,0,H2,300,H1,700,

     _,0,H1,H1,300,H1,0,H1,H2,300,_,_,_,0,M5,M5,300,H3,_,H2,_,H1,_,_,_,

     _,0,H1,H1,300,H1,0,H1,H2,300,_,0,H2,H2,H1,300,M7,700,H1,_,_,_,_,_,_,_,

     _,0,H1,H1,300,H1,0,H1,H2,300,_,_,_,0,M5,M5,300,H3,_,H2,_,H1,_,_,_,

     _,0,H1,H1,300,H1,0,H1,H2,300,_,0,H2,H2,H1,300,M7,700,H1,_,_,_,_,_,_,_,

      _,0,M6,M7,300,H1,0,H1,H1,_,300,H1,M7,M6,0,M5,300,M5,700,M5,_,0,M3,300,M2,700,M1,_,_,_,_,0,H1,H1,300,H1,0,H1,H2,_,300,H2,0,H1,300,H2,700,H3,_,_,_,H3,0,H2,300,H1,700,

     _,0,H1,H1,300,H1,0,H1,H2,300,_,_,_,0,M5,M5,300,H3,_,H2,_,H1,_,_,_,

     _,0,H1,H1,300,H1,0,H1,H2,300,_,0,H2,H2,H1,300,M7,700,H1,_,_,_,_,_,_,_,

    };

    for (auto i : hktk) {
        if (i == LOW_SPEED || i == HIGH_SPEED || i == MIDDLE_SPEED) {
            sleep = i;
            continue;
        }
        if (i == 0) { sleep = 200; continue; }
        if (i == 700) { Sleep(200); continue; }
        if (i == _) {
            Sleep(400);
            continue;
        }

        if (i == 1000) { tmp = +5; continue; }

        voice = (volume << 16) + ((i + tmp) << 8) + 0x90;
        midiOutShortMsg(handle, voice);
        cout << voice << endl;
        Sleep(sleep);
    }

    midiOutClose(handle);

}

int main(void)
{
    HKTK();
    return 0;
}

海闊天空

今天我 寒夜裡看雪飄過
懷著冷卻了的心窩漂遠方
風雨裏追趕 霧裡分不清影蹤
天空海闊你與我 可會變 (誰沒在變)

多少次 迎著冷眼與嘲笑
從沒有放棄過心中的理想
一剎那恍惚 若有所失的感覺
不知不覺已變淡 心裡愛 (誰明白我)

原諒我這一生不羈放縱愛自由
也會怕有一天會跌倒 oh-no
背棄了理想 誰人都可以
哪會怕有一天只你共我

今天我 寒夜裡看雪飄過
懷著冷卻了的心窩漂遠方
風雨裏追趕 霧裡分不清影蹤
天空海闊你與我 可會變 (誰沒在變)

原諒我這一生不羈放縱愛自由
也會怕有一天會跌倒 oh-no
背棄了理想 誰人都可以
哪會怕有一天只你共我 oh-yeah

仍然自由自我
永遠高唱我歌 走遍千里

原諒我這一生不羈放縱愛自由
也會怕有一天會跌倒 oh-no
背棄了理想 誰人都可以
哪會怕有一天只你共我 oh-yeah

(原諒我這一生不羈放縱愛自由) oh-yeah
(也會怕有一天會跌倒) oh-oh
(背棄了理想 誰人都可以) whoa-oh
(哪會怕有一天只你共我)文章来源地址https://www.toymoban.com/news/detail-675779.html

到了这里,关于情人节特别篇:用c++弹奏音乐“海阔天空”与“孤勇者”的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处: 如若内容造成侵权/违法违规/事实不符,请点击违法举报进行投诉反馈,一经查实,立即删除!

领支付宝红包 赞助服务器费用

相关文章

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

博客赞助

微信扫一扫打赏

请作者喝杯咖啡吧~博客赞助

支付宝扫一扫领取红包,优惠每天领

二维码1

领取红包

二维码2

领红包