用C做一个六边形怎么做啊?(c语言)

susu_ing 2016-04-17 09:51:50
我用的是c-free,drawpoly用不了,先是找不到标识符,想请教一下
...全文
897 10 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
10 条回复
切换为时间正序
请发表友善的回复…
发表回复
赵4老师 2016-04-22
  • 打赏
  • 举报
回复
用word或visio或ps或3dsmax画,不建议编程实现。
susu_ing 2016-04-22
  • 打赏
  • 举报
回复
引用 7楼一根烂笔头 的回复:
寻找相应的图形开发库,不建议自己在终端里画
好的
一根烂笔头 2016-04-20
  • 打赏
  • 举报
回复
寻找相应的图形开发库,不建议自己在终端里画
susu_ing 2016-04-20
  • 打赏
  • 举报
回复
引用 5楼赵4老师 的回复:
百度找不到在MSDN里面找。 原理参考《高中数学》三角函数。
好的
赵4老师 2016-04-19
  • 打赏
  • 举报
回复
百度找不到在MSDN里面找。 原理参考《高中数学》三角函数。
赵4老师 2016-04-18
  • 打赏
  • 举报
回复
#pragma comment(lib,"user32")
#pragma comment(lib,"gdi32")
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <windows.h>
extern "C" HWND WINAPI GetConsoleWindow();
void HideTheCursor() {
    CONSOLE_CURSOR_INFO cciCursor;
    HANDLE hStdOut = GetStdHandle(STD_OUTPUT_HANDLE);

    if(GetConsoleCursorInfo(hStdOut, &cciCursor)) {
        cciCursor.bVisible = FALSE;
        SetConsoleCursorInfo(hStdOut, &cciCursor);
    }
}
void ShowTheCursor() {
    CONSOLE_CURSOR_INFO cciCursor;
    HANDLE hStdOut = GetStdHandle(STD_OUTPUT_HANDLE);

    if(GetConsoleCursorInfo(hStdOut, &cciCursor)) {
        cciCursor.bVisible = TRUE;
        SetConsoleCursorInfo(hStdOut, &cciCursor);
    }
}
int main() {
    HWND  hwnd;
    HDC   hdc;
    int x[6],y[6];
    int i;

    for (i=0;i<6;i++) {
        x[i]=150+(int)(100.0*cos(i*60.0/180.0*3.1416));
        y[i]=150+(int)(100.0*sin(i*60.0/180.0*3.1416));
    }
    system("color F0");
    system("cls");
    HideTheCursor();
    hwnd  = GetConsoleWindow();
    hdc   = GetDC(hwnd);
    MoveToEx(hdc,x[0],y[0],NULL);
    LineTo(hdc,x[1],y[1]);
    LineTo(hdc,x[2],y[2]);
    LineTo(hdc,x[3],y[3]);
    LineTo(hdc,x[4],y[4]);
    LineTo(hdc,x[5],y[5]);
    LineTo(hdc,x[0],y[0]);
    ReleaseDC(hwnd,hdc);
    getchar();
    system("color 07");
    system("cls");
    ShowTheCursor();
    return 0;
}
lm_whales 2016-04-18
  • 打赏
  • 举报
回复
用三角函数吧
susu_ing 2016-04-18
  • 打赏
  • 举报
回复
引用 2 楼 zhao4zhong1 的回复:
#pragma comment(lib,"user32")
#pragma comment(lib,"gdi32")
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <windows.h>
extern "C" HWND WINAPI GetConsoleWindow();
void HideTheCursor() {
    CONSOLE_CURSOR_INFO cciCursor;
    HANDLE hStdOut = GetStdHandle(STD_OUTPUT_HANDLE);

    if(GetConsoleCursorInfo(hStdOut, &cciCursor)) {
        cciCursor.bVisible = FALSE;
        SetConsoleCursorInfo(hStdOut, &cciCursor);
    }
}
void ShowTheCursor() {
    CONSOLE_CURSOR_INFO cciCursor;
    HANDLE hStdOut = GetStdHandle(STD_OUTPUT_HANDLE);

    if(GetConsoleCursorInfo(hStdOut, &cciCursor)) {
        cciCursor.bVisible = TRUE;
        SetConsoleCursorInfo(hStdOut, &cciCursor);
    }
}
int main() {
    HWND  hwnd;
    HDC   hdc;
    int x[6],y[6];
    int i;

    for (i=0;i<6;i++) {
        x[i]=150+(int)(100.0*cos(i*60.0/180.0*3.1416));
        y[i]=150+(int)(100.0*sin(i*60.0/180.0*3.1416));
    }
    system("color F0");
    system("cls");
    HideTheCursor();
    hwnd  = GetConsoleWindow();
    hdc   = GetDC(hwnd);
    MoveToEx(hdc,x[0],y[0],NULL);
    LineTo(hdc,x[1],y[1]);
    LineTo(hdc,x[2],y[2]);
    LineTo(hdc,x[3],y[3]);
    LineTo(hdc,x[4],y[4]);
    LineTo(hdc,x[5],y[5]);
    LineTo(hdc,x[0],y[0]);
    ReleaseDC(hwnd,hdc);
    getchar();
    system("color 07");
    system("cls");
    ShowTheCursor();
    return 0;
}
想问问原理是什么?需要用到哪些函数?有的百度找不到啊
susu_ing 2016-04-18
  • 打赏
  • 举报
回复
想问问原理是什么,用到了什么函数?

70,023

社区成员

发帖
与我相关
我的任务
社区描述
C语言相关问题讨论
社区管理员
  • C语言
  • 花神庙码农
  • 架构师李肯
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧