Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "stdafx.h"
- #include <iostream>
- #include <Windows.h>
- using namespace std;
- int main() {
- HWND hWnd = GetConsoleWindow(); //дескриптор окна
- HDC hDC = GetDC(hWnd); //дескриптор контекста устройства
- HPEN Pen = CreatePen(PS_SOLID, 2, RGB(255, 255, 255));
- float scale = 30;
- POINT horizontalAxisCoordinates = { 25, 230 };
- POINT horizontalLineCoordinates = { 500, horizontalAxisCoordinates.y };
- POINT verticalAxisCoordinates = { 250, 50 };
- POINT verticalLineCoordinates = { verticalAxisCoordinates.x, 390 };
- SelectObject(hDC, Pen);
- MoveToEx(hDC, horizontalAxisCoordinates.x, horizontalAxisCoordinates.y, NULL);
- LineTo(hDC, horizontalLineCoordinates.x, horizontalLineCoordinates.y);
- MoveToEx(hDC, verticalAxisCoordinates.x, verticalAxisCoordinates.y, NULL);
- LineTo(hDC, verticalLineCoordinates.x, verticalLineCoordinates.y);
- for (float x = -7; x <= 7; x += 0.01)
- {
- MoveToEx(hDC, (int)(scale * x + 250), (int)(-scale * sin(x*4) + 230), NULL);
- LineTo(hDC, (int)(scale * x + 250), (int)(-scale * sin(x*4) + 230));
- }
- ReleaseDC(hWnd, hDC);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement