软件协会第01次活动第05次任务布置:爱心代码+演奏歌曲+typora使用pandoc导出+github注册登录+函数练习+写csdn文章(一)

简介: 软件协会第01次活动第05次任务布置:爱心代码+演奏歌曲+typora使用pandoc导出+github注册登录+函数练习+写csdn文章

🏠 官网:https://www.csuftsap.cn/

💬 任务布置说明:

  • 题目考察范围:函数
  • 所有答案均放在我所写的空代码块空引用框

🚀 本学期我们的练习到这里就结束了,如果我们的缘分未尽,寒假再见💓

1.程序员的浪漫-爱心代码(升级版)

1.1 官网下载EasyX

EasyX 是针对 C/C++ 的图形库,可以帮助使用C/C++语言的程序员快速上手图形和游戏编程。

比如,可以用 VC + EasyX 很快的用几何图形画一个房子,或者一辆移动的小车,可以编写俄罗斯方块、贪吃蛇、黑白棋等小游戏,可以练习图形学的各种算法,等等。

这里只是本次任务的小热身。

🏠 https://easyx.cn/download

1.2 安装EasyX

1.3 重启vs,新建项目并在其中创建一个.cpp文件(如果之前打开了vs,请重启vs)

也可以在vs界面内使用 ctrl + shift + A 快速创建文件

1.4 将如下代码拷贝到 love.cpp 文件中运行即可

#include<graphics.h>
#include<conio.h>
#include<time.h>
#include<math.h>
#include<stdlib.h>
/*
  作者:那蔚蓝天空 
*/
struct Point {
  double x, y;
  COLORREF color;
};
COLORREF colors[256] = { RGB(255,32,83),RGB(252,222,250) ,RGB(255,0,0) ,
RGB(255,0,0) ,RGB(255,2,2) ,RGB(255,0,8) ,RGB(255,5,5) };
const int xScreen = 1200;
const int yScreen = 800;
const double PI = 3.1426535159;
const double e = 2.71828;
const double averag_distance = 0.162;
const int quantity = 506;
const int circles = 210;
const int frames = 20;
Point  origin_points[quantity];
Point  points[circles * quantity];
IMAGE images[frames];
double screen_x(double x)
{
  x += xScreen / 2;
  return x;
}
double screen_y(double y)
{
  y = -y + yScreen / 2;
  return y;
}
int creat_random(int x1, int x2)
{
  if (x2 > x1)
    return  rand() % (x2 - x1 + 1) + x1;
}
void creat_data()
{
  int index = 0;
  double x1 = 0, y1 = 0, x2 = 0, y2 = 0;
  for (double radian = 0.1; radian <= 2 * PI; radian += 0.005)
  {
    x2 = 16 * pow(sin(radian), 3);
    y2 = 13 * cos(radian) - 5 * cos(2 * radian) - 2 * cos(3 * radian)
      - cos(4 * radian);
    double distance = sqrt(pow(x2 - x1, 2) + pow(y2 - y1, 2));
    if (distance > averag_distance)
    {
      x1 = x2, y1 = y2;
      origin_points[index].x = x2;
      origin_points[index++].y = y2;
    }
  }
  index = 0;
  for (double size = 0.1, lightness = 1.5; size <= 20; size += 0.1)
  {
    double success_p = 1 / (1 + pow(e, 8 - size / 2));
    if (lightness > 1) lightness -= 0.0025;
    for (int i = 0; i < quantity; ++i)
    {
      if (success_p > creat_random(0, 100) / 100.0)
      {
        COLORREF color = colors[creat_random(0, 6)];
        points[index].color = RGB(GetRValue(color) / lightness, GetGValue(color) / lightness, GetBValue(color) / lightness);
        points[index].x = size * origin_points[i].x + creat_random(-4, 4);
        points[index++].y = size * origin_points[i].y + creat_random(-4, 4);
      }
    }
  }
  int points_size = index;
  for (int frame = 0; frame < frames; ++frame)
  {
    images[frame] = IMAGE(xScreen, yScreen);
    SetWorkingImage(&images[frame]);
    for (index = 0; index < points_size; ++index)
    {
      double x = points[index].x, y = points[index].y;
      double distance = sqrt(pow(x, 2) + pow(y, 2));
      double diatance_increase = -0.0009 * distance * distance
        + 0.35714 * distance + 5;
      double x_increase = diatance_increase * x / distance / frames;
      double y_increase = diatance_increase * y / distance / frames;
      points[index].x += x_increase;
      points[index].y += y_increase;
      setfillcolor(points[index].color);
      solidcircle(screen_x(points[index].x), screen_y(points[index].y), 1);
    }
    for (double size = 17; size < 23; size += 0.3)
    {
      for (index = 0; index < quantity; ++index)
      {
        if ((creat_random(0, 100) / 100.0 > 0.6 && size >= 20)
          || (size < 20 && creat_random(0, 100) / 100.0 > 0.95))
        {
          double x, y;
          if (size >= 20)
          {
            x = origin_points[index].x * size +
              creat_random(-frame * frame / 5 - 15, frame * frame / 5 + 15);
            y = origin_points[index].y * size +
              creat_random(-frame * frame / 5 - 15, frame * frame / 5 + 15);
          }
          else
          {
            x = origin_points[index].x * size + creat_random(-5, 5);
            y = origin_points[index].y * size + creat_random(-5, 5);
          }
          setfillcolor(colors[creat_random(0, 6)]);
          solidcircle(screen_x(x), screen_y(y), 1);
        }
      }
    }
  }
  SetWorkingImage();
}
int main()
{
  initgraph(xScreen, yScreen);
  BeginBatchDraw();
  srand(time(0));
  creat_data();
  bool extend = true, shrink = false;
  for (int frame = 0; !_kbhit();)
  {
    putimage(0, 0, &images[frame]);
    FlushBatchDraw();
    Sleep(20);
    cleardevice();
    if (extend)
      frame == 19 ? (shrink = true, extend = false) : ++frame;
    else
      frame == 0 ? (shrink = false, extend = true) : --frame;
  }
  EndBatchDraw();
  closegraph();
  return 0;
} 

1.5 📍 运行该 .cpp 文件

将你运行出来的结果截图放入下面的引用框中:

2.演奏歌曲(选做)

💬 只需要将刚才写的 love.cpp 文件里的全部代码替换为下面的代码即可,你也可以选择新开文件,但一定是以 .cpp 结尾的文件。以下代码不需要用到 EasyX 插件。如果你对演奏音乐感兴趣,那么当你学到 C++ 的时候就可以去学习用代码演奏自己喜欢的音乐,这不会太难,只要找到你选择的歌曲的谱子按照对应关系填写对应代码即可。一定要谱一曲《告白气球》,去和你爱的男孩或女孩表白❤️

2.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 Trivial()
{
    HMIDIOUT handle;
    midiOutOpen(&handle, 0, 0, 0, CALLBACK_NULL);
    int volume = 0x7f;
    int voice = 0x0;
    int sleep = 300;
    int trivial[] =
    {
       MIDDLE_SPEED, X6,L6,M3,M1,M1,L4,M4,M1,X1,L5,M3,M1,L7,M1,M2,L5,X6,L6,M3,M1,M1,L4,M4,M1,X1,L5,M3,M1,L7,M1,M2,L5,_,_,
       400,M3,M3,0,M6,M6,_,_,400,M1,M2,0,M3,M3,_,400,_,_,_,_,_,_,_,_,M3,M3,0,M6,M6,_,_,400,_,M5,M5,M4,M3,_,_,_,_,_,_,_,_,
       M3,M3,M6,_,M1,M2,M3,_,_,_,_,_,_,_,M3,M3,M1,M4,0,M4,M4,_,400,M3,M1,_,_,_,
       400,M3,M3,0,M6,M6,_,_,400,M1,M2,0,M3,M3,_,400,_,_,_,_,_,_,_,_,M3,M3,0,M6,M6,_,_,400,_,M5,M5,M4,M3,_,_,_,_,_,_,_,_,
       M3,M3,M6,_,M1,M2,M3,_,_,_,_,_,_,_,M3,M3,M1,M4,0,M4,M4,_,400,M3,M1,_,_,_,_,_,
       M5,M6,M7,H1,0,M7,H1,_,M5,300,M6,M6,_,M5,0,M4,M3,_,300,M3,M3,0,M3,M2,_,300,M5,M6,M7,H1,0,M7,H1,_,M5,300,M6,M6,_,M6,0,H1,H1,_,300,H1,H1,0,H1,H2,_,M5,300,
       M6,M7,H1,0,M7,H1,_,H3,700,H6,700,H5,_,H4,H3,_,H3,H2,_,
       M6,700,M7,H1,_,700,H1,0,H2,H1,_,H1,M7,300,H1,0,H2,_,H1,700,M7,H1,_,_,_,
       400,M3,M3,0,M6,M6,_,_,400,M1,M2,0,M3,M3,_,400,_,_,_,_,_,_,_,_,M3,M3,0,M6,M6,_,_,400,_,M5,M5,M4,M3,_,_,_,_,_,_,_,_,
       M3,M3,M6,_,M1,M2,M3,_,_,_,_,_,_,_,M3,M3,M1,M4,0,M4,M4,_,400,M3,M1,_,_,_,_,_,
       M5,M6,M7,H1,0,M7,H1,_,M5,300,M6,M6,_,M5,0,M4,M3,_,300,M3,M3,0,M3,M2,_,300,M5,M6,M7,H1,0,M7,H1,_,M5,300,M6,M6,_,M6,0,H1,H1,_,300,H1,H1,0,H1,H2,_,M5,300,M6,M7,H1,0,M7,H1,_,H3,700,H6,700,H5,_,H4,H3,_,H3,H2,_,
       M6,700,M7,H1,_,700,H1,0,H2,H1,_,H1,M7,300,H1,0,H2,_,H1,700,M7,H1,_,_,_,
       M5,0,L7,M1,_,_,L7,300,M1,0,L7,M1,300,L7,L5,M5,0,L7,M1,_,L7,300,M7,0,L6,L7,300,M1,L5,M5,0,L7,M1,_,_,L7,300,M1,0,L7,M1,300,M2,L5,M5,0,L7,M1,_,L7,L7,M1,300,M2,M2,_,
       M5,0,L7,M1,_,_,L7,300,M1,0,L7,M1,300,L7,L5,M5,0,M5,M1,300,M1,700,0,M1,300,L7,0,L6,L7,300,M1,L5,M5,0,L7,M1,_,L7,300,M1,0,M2,M3,300,M4,M3,M1,0,L5,M1,300,M2,0,M1,M2,M2,M3,300,M4,M3,_,
       M5,0,L7,M1,_,_,L7,300,M1,0,L7,M1,300,L7,L5,M5,0,L7,M1,_,_,L7,300,M1,0,L7,M1,300,L7,L5,M5,0,L7,M1,_,_,L7,300,M1,0,L7,L6,300,M2,L5,M5,0,L7,M1,_,L7,L7,M1,300,M2,M2,_,
       M5,0,M2,M3,300,M3,M1,M2,0,M3,M4,300,M6,M5,M5,_,M5,_,M4,0,M3,M2,300,M3,M5,0,L7,M1,_,L7,300,M1,0,M2,M3,300,M4,M3,M4,0,M3,M2,300,M1,0,M5,M1,M2,M3,300,M4,M3,_,
       X6,L6,M3,M1,M1,L4,M4,M1,X1,L5,M3,M1,L7,M1,M2,L5,
       X6,L6,M3,M1,M1,L4,M4,M1,X1,L5,M3,M1,L7,M1,M2,L5,
       X6,L6,M3,M1,M1,L4,M4,M1,X1,L5,M3,M1,L7,M1,M2,L5,
       X6,L6,M3,M1,M1,L4,M4,M1,X1,L5,M3,M1,_,_,
       M5,M6,M7,H1,0,M7,H1,_,M5,300,M6,M6,_,M5,0,M4,M3,_,300,M3,M3,0,M3,M2,_,300,M5,M6,M7,H1,0,M7,H1,_,M5,300,M6,M6,_,M6,0,H1,H1,_,300,H1,H1,0,H1,H2,_,M5,300,M6,M7,H1,0,M7,H1,_,H3,700,H6,700,H5,_,H4,H3,_,H3,H2,_,
       M6,700,M7,H1,_,700,H1,0,H2,H1,_,H1,M7,300,H1,0,H2,_,H1,0,M7,H1,300,H1,
       M5,M6,M7,H1,0,M7,H1,_,M5,300,M6,M6,_,M5,0,M4,M3,_,300,M3,M3,0,M3,M2,_,300,M5,M6,M7,H1,0,M7,H1,_,M5,300,M6,M6,_,M6,0,H1,H1,_,300,H1,H1,0,H1,H2,_,M5,300,M6,M7,H1,0,M7,H1,_,H3,700,H6,700,H5,_,H4,H3,_,H3,H2,_,
       M6,700,M7,H1,_,700,H1,0,H2,H1,_,H1,M7,300,H1,0,H2,_,H1,0,M7,H1,300,H1,
       M5,M6,M7,H1,0,M7,H1,_,M5,300,M6,M6,_,M5,0,M4,M3,_,300,M3,M3,0,M3,M2,_,300,M5,M6,M7,H1,0,M7,H1,_,M5,300,M6,M6,_,M6,0,H1,H1,_,300,H1,H1,0,H1,H2,_,M5,300,
       M6,M7,H1,0,M7,H1,_,H3,700,H6,700,H5,_,H4,H3,_,H3,H2,_,M6,700,M7,H1,_,700,H1,0,H2,H1,_,H1,M7,300,H1,0,H2,_,H1,700,M7,H1,_,_,_,
       400,M3,M3,0,M6,M6,_,_,400,M1,M2,0,M3,M3,_,400,_,_,_,_,_,_,_,_,M3,M3,0,M6,M6,_,_,400,_,M5,M5,M4,M3,_,_,_,_,_,_,_,_,
       M3,M3,M6,_,M1,M2,M3,_,_,_,_,_,_,_,M3,M3,M1,0,M4,300,M4,M4,_,400,M3,M1,_,_,_,_,_,
    };
    for (auto i : trivial) {
        if (i == LOW_SPEED || i == HIGH_SPEED || i == MIDDLE_SPEED) {
            sleep = i;//Sleep(i/2);
            continue;
        }
        if (i == 0) { sleep = 150; continue; }
        if (i == 700) { Sleep(180); continue; }
        if (i == _) {
            Sleep(300);
            continue;
        }
        voice = (volume << 16) + (i << 8) + 0x90;
        midiOutShortMsg(handle, voice);
        cout << voice << endl;
        Sleep(sleep);
    }
    midiOutClose(handle);
}
int main()
{
    Trivial();
    return 0;
}

2.2 海阔天空

#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);
    //midiOutShortMsg(handle, 34 << 8 | 0xC0);
    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;//Sleep(i/2);
            continue;
        }
        if (i == 0) { sleep = 200; continue; }
        if (i == 700) { Sleep(200); continue; }
        if (i == _) {
            Sleep(400);
            continue;
        }
        if (i == 1000) { tmp = +5; continue; }
        // if (i == 900) volume += 100;
        voice = (volume << 16) + ((i + tmp) << 8) + 0x90;
        midiOutShortMsg(handle, voice);
        cout << voice << endl;
        Sleep(sleep);
    }
    midiOutClose(handle);
}
int main()
{
    HKTK();
    return 0;
}


相关文章
|
13天前
|
Ubuntu Linux Shell
github用存在的私钥在Linux上配置免密登录
在Linux上配置GitHub免密登录,使用已有的私钥。系统环境为Ubuntu 22.04.3 LTS。步骤包括:1) 将名为`github`的私钥文件上传至`~/.ssh/github`;2) 设置正确权限`chmod 600 ~/.ssh/github`和`chmod 700 ~/.ssh`;3) 启动SSH代理并添加私钥`ssh-agent -s`和`ssh-add ~/.ssh/github`。完成上述步骤后,可以无缝使用GitHub。
20 0
|
1天前
|
Shell 测试技术 网络安全
【GIT】如何在GitHub上向一个开源项目贡献代码?
【GIT】如何在GitHub上向一个开源项目贡献代码?
20 5
|
18天前
|
算法 程序员 开发工具
GitHub上新!14个Python项目详细教程(附完整代码)
Python作为程序员的宠儿,越来越得到人们的关注,使用Python进行应用程序开发的也越来越多。 今天给小伙伴们分享的这份项目教程完整代码已上传至GitHub,你可以选择跟着这份教程一段一段的手敲出来这几个项目,也可以直接从GitHub上copy下来。
|
21天前
|
Shell 开发工具 git
[oeasy]python019_ 如何在github仓库中进入目录_找到程序代码_找到代码
本文档介绍了如何在终端环境下使用Git克隆仓库后,通过`cd`、`pwd`和`ls`命令导航并找到下载的文件。首先,使用`ls`查看当前目录,然后通过`cd`逐层进入目标文件夹,最后到达包含游戏文件game.py的位置。文章还提到了如果`git clone`失败,可以直接进行下一节实验。
22 0
|
24天前
|
网络安全
IDEA 提交代码到 GitHub 时发生错误
摘要: 在遇到访问 GitHub 时的错误,这两个命令分别用于处理 SSL 连接问题和连接超时问题。
|
27天前
|
算法 程序员 开发工具
GitHub上新!14个Python项目详细教程(附完整代码)
Python作为程序员的宠儿,越来越得到人们的关注,使用Python进行应用程序开发的也越来越多。 今天给小伙伴们分享的这份项目教程完整代码已上传至GitHub,你可以选择跟着这份教程一段一段的手敲出来这几个项目,也可以直接从GitHub上copy下来。
|
1月前
|
文字识别 异构计算 Python
关于Github中开源OCR项目的实验过程与思考
新手尝试Git clone Python OCR项目,遇到各种报错。测试了Paddle OCR、Tesseract OCR和EasyOCR。Paddle OCR因平台限制未能在Notebook部署,Tesseract OCR在Colab成功但无法复现。EasyOCR最终在阿里云天池和Colab部署成功,但天池GPU资源不足。建议使用魔搭社区的实例,阿里云提供免费OCR服务。寻求简单OCR项目推荐。附EasyOCR安装和使用代码。
63 2
|
1月前
|
人工智能 自然语言处理 iOS开发
『GitHub项目圈选19』推荐5款本周 让人爱不释手 的开源项目
『GitHub项目圈选19』推荐5款本周 让人爱不释手 的开源项目
|
1月前
|
存储 Web App开发 人工智能
『GitHub项目圈选18』推荐5款本周 超实用 的开源项目
『GitHub项目圈选18』推荐5款本周 超实用 的开源项目
227 1
|
1月前
|
人工智能 物联网 机器人
『GitHub项目圈选17』推荐5款本周 火火火 的AI开源项目
『GitHub项目圈选17』推荐5款本周 火火火 的AI开源项目
530 1