求助大佬,一个简单的矩形框,为什么打出来的和效果图不一样呢?



#include<stdio.h>#include<windows.h> int width=16;int height=9;//gotoxy源文件 void gotoxy(int x, int y) { COORD pos; pos.X=x; pos.Y=y; SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE),pos);}//游戏界面 void drawInterface( ){ //上下 int i=0, j=0; for(j=0;j<height;j+=height-1) { gotoxy(j,0); for(i=0;i<width;i++) { printf("-"); } printf("\n"); }//左右 for(j=0;j<width;j+=width-1) { for(i=0;i<height-2;i++) { gotoxy(i+1,j); printf("|\n"); } } }main( ){ drawInterface( ); return 0;}