一==︼︻*—[. 。.]-b
taskkill /f /im StudentMain.exe
takeown /f "C:\Program Files (x86)\Mythware\紫域电子教室" /r /d y
icacls "C:\Program Files (x86)\Mythware\紫域电子教室" /grant administrators:F /t
rd /s /q "C:\Program Files (x86)\Mythware\紫域电子教室"↑ 胡言乱语
#include <bits/stdc++.h>
#include <windows.h>
using namespace std;
int d[7] = {523,578,659,698,784,880,988};
int w (int a,int b) {
return d[a] * pow(2,b);
}
void P (int a,int b,int k) {
Beep(w(a - 1,b),k);
}
int main () {
P(5,0,1000);
P(3,0,1000);
P(1,0,1000);
P(5,-1,1000);
P(6,-1,500);
P(7,-1,500);
P(1,0,500);
P(6,-1,1000);
P(1,0,500);
P(5,-1,2000);
P(2,0,1000);
P(5,0,1000);
P(3,0,1000);
P(1,0,1000);
P(6,-1,500);
P(7,-1,500);
P(1,0,500);
P(2,0,1000);
P(3,0,1000);
P(2,0,2000);
}/**************************
* Includes
*
**************************/
#include <windows.h>
#include <gl/gl.h>
#include <cmath>
#include <iostream>
#define pi (3.1415926535897932384626433832795)
/**************************
* Function Declarations
*
**************************/
LRESULT CALLBACK WndProc (HWND hWnd, UINT message,
WPARAM wParam, LPARAM lParam);
void EnableOpenGL (HWND hWnd, HDC *hDC, HGLRC *hRC);
void DisableOpenGL (HWND hWnd, HDC hDC, HGLRC hRC);
float eps = 1e-10;
void circle(float cx, float cy, float r,float color) {
glBegin(GL_POINTS);
for (float x = -r; x <= r; x+= 0.0001) {
float y = sqrt(r * r - x * x);
for (float t = cy - y;t <= cy + y;t += 0.0001) glVertex2f(cx + x, t);
// glVertex2f(cx + x, cy - y);
}
glEnd();
}
float apie (float a,float b,float theta) {
if (a == 0) a = eps;
if (a < 0 && b < 0) {
return - sqrt(a * a + b * b) * cos(atan(b/a) + theta);
}
else if (a < 0) {
return - sqrt(a * a + b * b) * cos(atan(-b/a) - theta);
}
else if (b < 0) {
return sqrt(a * a + b * b) * cos(atan(-b/a) - theta);
}
return sqrt(a * a + b * b) * cos(atan(b/a) + theta);
//return a;
}
float bpie (float a,float b,float theta) {
if (a == 0) a = eps;
if (a < 0 && b < 0) {
return - sqrt(a * a + b * b) * sin(atan(b/a) + theta);
}
else if (a < 0) {
return sqrt(a * a + b * b) * sin(atan(-b/a) - theta);
}
else if (b < 0) {
return - sqrt(a * a + b * b) * sin(atan(-b/a) - theta);
}
return sqrt(a * a + b * b) * sin(atan(b/a) + theta);
//return b;
}
void fang (float x,float y,float r,float a,float b,float c,float theta) {
glBegin (GL_TRIANGLES);
glColor3f (a, b, c); glVertex2f (apie(r,r,theta) + x, bpie(r,r ,theta) + y);
glColor3f (a, b, c); glVertex2f (apie(r,-r,theta) + x, bpie(r ,-r ,theta) + y);
glColor3f (a, b, c); glVertex2f (apie(-r,r,theta) + x, bpie(-r ,r ,theta) + y);
glEnd ();
glBegin (GL_TRIANGLES);
glColor3f (a, b, c); glVertex2f (apie(-r ,-r,theta) + x, bpie(-r ,-r ,theta) + y);
glColor3f (a, b, c); glVertex2f (apie(r ,-r,theta) + x, bpie(r ,-r,theta) + y);
glColor3f (a, b, c); glVertex2f (apie(-r ,r,theta) + x,bpie(-r ,r,theta) + y);
glEnd ();
}
/**************************
* WinMain
*
**************************/
double x1[12] = {0,0.18749999999999997,0.3247595264191645,0.375,0.3247595264191645,0.1875000000000001,0,-0.1874999999999999,-0.3247595264191644,-0.375,-0.3247595264191646,-0.18750000000000017}; // dx
double y1[12] = { 0.375,0.3247595264191645,0.18750000000000006,0,-0.18749999999999992,-0.32475952641916445,-0.375,-0.32475952641916456,-0.18750000000000017,0,0.18749999999999975,0.3247595264191644};
double x2[12] = {0.0391086,0.15733,0.233395,0.246922,0.194286,0.089592,-0.0391086,-0.15733,-0.233395,-0.246922,-0.194286,-0.089592};
double y2[12] = {0.246922,0.194286,0.089592,-0.0391086,-0.15733,-0.233395,-0.246922,-0.194286,-0.089592,0.0391086,0.15733,0.233395};
double x3[12] = {-0.0391086,0.089592,0.194286,0.246922,0.233395,0.15733,0.0391086,-0.089592,-0.194286,-0.246922,-0.233395,-0.15733};
double y3[12] = {0.246922,0.233395,0.15733,0.0391086,-0.089592,-0.194286,-0.246922,-0.233395,-0.15733,-0.0391086,0.089592,0.194286};
int WINAPI WinMain (HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int iCmdShow)
{
WNDCLASS wc;
HWND hWnd;
HDC hDC;
HGLRC hRC;
MSG msg;
BOOL bQuit = FALSE;
float theta = 0.0f,th[5000] = {-0.5,-0.3,0.2,0.1,0.8},x[5000] = {0.4,0,0.3,-0.5,0.8},y[5000] = {-0.4,0,0.5,0.6,-0.2},dx[5000] = {0.015,0},dy[5000] = {0.025,0,-0.01},n = 4,m[5000] = {1.4,2.2,5,0.8,3};
float ca[5] = {0.8,0.2,0.1,0.5,0.7};
float cb[5] = {0.2,0.8,0.3,0.5,0.1};
float cc[5] = {0.0,0.5,0.8,0.1,0.9};
/* register window class */
wc.style = CS_OWNDC;
wc.lpfnWndProc = WndProc;
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
wc.hInstance = hInstance;
wc.hIcon = LoadIcon (NULL, IDI_APPLICATION);
wc.hCursor = LoadCursor (NULL, IDC_ARROW);
wc.hbrBackground = (HBRUSH) GetStockObject (BLACK_BRUSH);
wc.lpszMenuName = NULL;
wc.lpszClassName = "GLSample";
RegisterClass (&wc);
/* create main window */
hWnd = CreateWindow (
"GLSample", "OpenGL Sample",
WS_CAPTION | WS_POPUPWINDOW | WS_VISIBLE,
0, 0, 400, 400,
NULL, NULL, hInstance, NULL);
/* enable OpenGL for the window */
EnableOpenGL (hWnd, &hDC, &hRC);
/* program main loop */
while (!bQuit)
{
/* check for messages */
if (PeekMessage (&msg, NULL, 0, 0, PM_REMOVE))
{
/* handle or dispatch messages */
if (msg.message == WM_QUIT)
{
bQuit = TRUE;
}
else
{
TranslateMessage (&msg);
DispatchMessage (&msg);
}
}
else
{
/* OpenGL animation code goes here */
glClearColor (0.0f, 0.0f, 0.8f, 1.0f);
glClear (GL_COLOR_BUFFER_BIT);
glPushMatrix ();
glRotatef (0, 0.0f, 0.0f, 1.0f);
// fang (0,0,0.2,0,0,1,theta);
circle (0,0,0.2,1145);
for (int i = 0;i < 12;i ++) {
glBegin (GL_TRIANGLES);
glVertex2f (x1[i],y1[i]);
glVertex2f (x2[i],y2[i]);
glVertex2f (x3[i],y3[i]);
glEnd ();
}
glPopMatrix ();
SwapBuffers (hDC);
theta += 0.1;
Sleep (1);
}
}
/* shutdown OpenGL */
DisableOpenGL (hWnd, hDC, hRC);
/* destroy the window explicitly */
DestroyWindow (hWnd);
return msg.wParam;
}
/********************
* Window Procedure
*
********************/
LRESULT CALLBACK WndProc (HWND hWnd, UINT message,
WPARAM wParam, LPARAM lParam)
{
switch (message)
{
case WM_CREATE:
return 0;
case WM_CLOSE:
PostQuitMessage (0);
return 0;
case WM_DESTROY:
return 0;
case WM_KEYDOWN:
switch (wParam)
{
case VK_ESCAPE:
PostQuitMessage(0);
return 0;
}
return 0;
default:
return DefWindowProc (hWnd, message, wParam, lParam);
}
}
/*******************
* Enable OpenGL
*
*******************/
void EnableOpenGL (HWND hWnd, HDC *hDC, HGLRC *hRC)
{
PIXELFORMATDESCRIPTOR pfd;
int iFormat;
/* get the device context (DC) */
*hDC = GetDC (hWnd);
/* set the pixel format for the DC */
ZeroMemory (&pfd, sizeof (pfd));
pfd.nSize = sizeof (pfd);
pfd.nVersion = 1;
pfd.dwFlags = PFD_DRAW_TO_WINDOW |
PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER;
pfd.iPixelType = PFD_TYPE_RGBA;
pfd.cColorBits = 24;
pfd.cDepthBits = 16;
pfd.iLayerType = PFD_MAIN_PLANE;
iFormat = ChoosePixelFormat (*hDC, &pfd);
SetPixelFormat (*hDC, iFormat, &pfd);
/* create and enable the render context (RC) */
*hRC = wglCreateContext( *hDC );
wglMakeCurrent( *hDC, *hRC );
}
/******************
* Disable OpenGL
*
******************/
void DisableOpenGL (HWND hWnd, HDC hDC, HGLRC hRC)
{
wglMakeCurrent (NULL, NULL);
wglDeleteContext (hRC);
ReleaseDC (hWnd, hDC);
}