编程中的图形绘制与STL算法详解
1. 图形绘制相关内容
在图形绘制方面,有两组不同的代码实现,分别是基于Windows控制台函数和Borland控制台函数的实现。
1.1 msoftcon.h和msoftcon.cpp
msoftcon.h
文件主要用于声明Lafore的控制台图形函数,它使用了Windows的控制台函数。以下是该文件的代码:
//msoftcon.h
//declarations for Lafore’s console graphics functions
//uses Window’s console functions
#ifndef _INC_WCONSOLE //don’t let this file be included
#define _INC_WCONSOLE //twice in the same source file
#include <windows.h> //for Windows console functions
#include <conio.h> //for kbhit(), getche()
#include <math.h> //for sin, cos
enum fstyle { SOLID_FILL, X_FILL, O_FILL,
LIGHT_FILL, MEDIUM_FILL, DARK_FILL };
enum color {
cBLACK=0, cDARK_BLUE=1, cDARK_GREEN