task 1.1

 avatar
unknown
c_cpp
2 years ago
539 B
4
Indexable
#define _USE_MATH_DEFINES
#include <iostream>
#include <windows.h>
#include <cmath>

using namespace std;

double calculateY(double x) {
    return abs(cos(2*x));
}

int main() {
    double x;
    HANDLE hCon;
    COORD cPos;
    hCon = GetStdHandle(STD_OUTPUT_HANDLE);

    for (int i = 1; i <= 80; i++) {
        cPos.X = i;

        x = (i-1)*2*M_PI/79.0;
        cPos.Y = trunc(-25+26*calculateY(x));
        
        SetConsoleCursorPosition (hCon, cPos);
        cout << "*";
    }

    system("pause");
}
Editor is loading...