痛并快乐着的学习机 2022-04-27 22:17 采纳率: 33.3%
浏览 53
已结题

图形画反了,有啥问题吗?

#include <stdio.h>
#include <stdlib.h>
#include <stddef.h>
#include "graphics.h"
#include "genlib.h"
#include "conio.h"

#include <windows.h>
#include <olectl.h>
#include <stdio.h>
#include <mmsystem.h>
#include <wingdi.h>
#include <ole2.h>
#include <ocidl.h>
#include <winuser.h>

#define houseHeight         3.0
#define houseWidth          2.0
#define atticHeight         1.0
#define Height              0.3
#define Width               0.4




void DrawHouse(double x, double y);
void DrawOutline(double x, double y);
void DrawBox(double x, double y, double width, double height);
void DrawGrid(double x, double y, double width, double height,
              int columns, int rows);
void Drawdoor(double x, double y, double n);              
void DrawTriangle(double x, double y, double base, double height);
void Main()
{
    double cx, cy;

    InitGraphics();
    cx = GetWindowWidth() / 2;
    cy = GetWindowHeight() / 2;
    DrawHouse(cx - 2*houseWidth,
              cy - houseHeight);
}

void DrawHouse(double x, double y){
    DrawGrid( x, y, houseWidth, houseHeight, 4.0, 2.0);
    DrawTriangle( x,  y, houseWidth, atticHeight);
    DrawTriangle( x+3*houseWidth,  y, houseWidth, atticHeight);
    double s=x+houseWidth;
    Drawdoor( s, y, Width, Height, 6);
}










void Drawdoor(double x, double y,double width, double height, double n){
    int i;
    for(i=1;i<=n;i++){
        DrawBox(x, y, width, height);
        x=x+2*Width;
    }
    
}
void DrawGrid(double x, double y, double width, double height,
              int columns, int rows)
{
    int i, j;

    for (i = 0; i < columns; i++) {
        for (j = 0; j < rows; j++) {
            DrawBox(x + i * width, y + j * height,
                    width, height);
        }
    }
}
void DrawBox(double x, double y, double width, double height)
{
    MovePen(x, y);
    DrawLine(0, height);
    DrawLine(width, 0);
    DrawLine(0, -height);
    DrawLine(-width, 0);
}
void DrawTriangle(double x, double y, double base, double height)
{
    MovePen(x, y);
    DrawLine(base, 0);
    DrawLine(-base / 2, height);
    DrawLine(-base / 2, -height);
}

我的图

img


原图

https://img-mid.csdnimg.cn/release/static/image/mid/ask/923198070156127.png "#left") img

https://img-mid.csdnimg.cn/release/static/image/mid/ask/600467070156150.png "#left")

  • 写回答

4条回答 默认 最新

  • 溪风沐雪 2022-04-27 22:26
    关注

    找一下函数Drawdoor声明的地方,看看声明的时候是几个参数
    void Drawdoor(double x, double y, double n);
    你声明的时候3个参数,实现的时候5个参数,问题就在这里了

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论 编辑记录
查看更多回答(3条)

报告相同问题?

问题事件

  • 系统已结题 5月6日
  • 已采纳回答 4月28日
  • 修改了问题 4月27日
  • 修改了问题 4月27日
  • 展开全部

悬赏问题

  • ¥50 求解vmware的网络模式问题 别拿AI回答
  • ¥24 EFS加密后,在同一台电脑解密出错,证书界面找不到对应指纹的证书,未备份证书,求在原电脑解密的方法,可行即采纳
  • ¥15 springboot 3.0 实现Security 6.x版本集成
  • ¥15 PHP-8.1 镜像无法用dockerfile里的CMD命令启动 只能进入容器启动,如何解决?(操作系统-ubuntu)
  • ¥30 请帮我解决一下下面六个代码
  • ¥15 关于资源监视工具的e-care有知道的嘛
  • ¥35 MIMO天线稀疏阵列排布问题
  • ¥60 用visual studio编写程序,利用间接平差求解水准网
  • ¥15 Llama如何调用shell或者Python
  • ¥20 谁能帮我挨个解读这个php语言编的代码什么意思?