⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 grid.cpp

📁 C++&datastructure书籍源码,以前外教提供现在与大家共享
💻 CPP
字号:
#include "canvas.h"     // for Canvas
#include "strutils.h"   // for tostring(int)
// illustrates line and text drawing in Canvas class
int main()
{
    const int GRID_SIZE = 200;
    const int SIZE=  20;   // fudge dimensions to make room for text
    Canvas c(GRID_SIZE+SIZE, GRID_SIZE+SIZE,100,100);
    int j;
    for(j=0; j <= GRID_SIZE; j+= SIZE)
    {   c.SetColor(BLACK);       
        c.DrawString(tostring(j), Point(0,j));  // draw text labels
        c.DrawString(tostring(j), Point(j,0));
    }
    c.SetColor(BLUE);
    for(j=0; j <= GRID_SIZE; j+= SIZE)
    {   c.DrawLine(Point(j,0), Point(j,GRID_SIZE));  // horizontal line 
        c.DrawLine(Point(0,j), Point(GRID_SIZE,j));  // vertical line
    }    
    c.runUntilEscape();
    return 0;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -