用ASCII码编写一个程序,用双线字符在屏幕上打印一个方框。你说我哪里错了捏?
/* Demonstrates using different double-line *//* to draw a aquare on the screen*/
#include<stdio.h>
#define LENGTH 10 /* set the length of this square */
unsigned char stand_double_line = 186; //字符‘‖’=186
unsigned char level_double_line = 205; //字符'〓'=205
unsigned char top_left = 201; //字符'『'=201
unsigned char top_right = 187; //字符'﹃'=187
unsigned char bot_left =200; //字符'﹄'=188
unsigned char bot_right =188; //字符'』'=188
int x,y;
int main( void )
{
x=1; //代表列
y=1; //代表行
/*第一行*/
printf("%c",top_left);
y++;
for(x = 2; x < LENGTH ; x++)
printf("%c",level_double_line);
printf("%c\n",top_right); //包括换行
/*第二行到第九行*/
for(y = 2;y < LENGTH; y++ )
{
for(x=1; (x=1) || (x= LENGTH); x++)
printf("%c",stand_double_line); //当x在第1列或者最后一列
printf("\n"); //每行结尾换行
}
/*最后一行*/
printf("%c",bot_left);
for(x = 2; x < LENGTH ; x++)
printf("%c",level_double_line);
printf("%c\n",bot_right);
return 0;
}
//谢谢了先哈,