Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <Windows.h>
- #include <stdlib.h>
- #include <math.h>
- #include <iostream>
- using namespace std;
- double f(double x)
- {
- return x*x+1000;
- }
- /*double privedenie_po_Y(double y) {
- double result = 100 * y + (double)(597/ 4);
- return result;
- }*/
- int main()
- {
- float x;
- HDC hDC = GetDC(GetConsoleWindow());
- HWND hwnd = GetConsoleWindow();
- RECT Rect;
- GetWindowRect(hwnd, &Rect);
- double size_x = Rect.right - Rect.left - 40;
- double size_y = Rect.bottom - Rect.top - 50;
- cout << size_y;
- HPEN Pen = CreatePen(PS_SOLID, 4, RGB(255, 255, 255));
- SelectObject(hDC, Pen);
- double a = f(0);
- while (true)
- {
- GetWindowRect(hwnd, &Rect);
- double size_x = Rect.right - Rect.left - 40;
- double size_y = Rect.bottom - Rect.top - 50;
- MoveToEx(hDC, 0, size_y / 2 + (a), NULL);
- LineTo(hDC, 1 * size_x, 1 * size_y / 2+(a));
- MoveToEx(hDC, 1 * size_x / 2, 0, NULL);
- LineTo(hDC, 1 * size_x / 2, 1 * size_y);
- for (x = -3.14; x <= 3.14; x += 0.01)
- {
- MoveToEx(hDC, 100 * x + 1 * size_x / 2, -100 * (f(x)- a) + 1 * size_y / 2, NULL);
- LineTo(hDC, 100 * x + 1 * size_x / 2, -100 * (f(x)- a) + 1 * size_y / 2);
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment