当前位置: 代码迷 >> C语言 >> c语言基础"如何用星号画出一个矩形?"
  详细解决方案

c语言基础"如何用星号画出一个矩形?"

热度:995   发布时间:2007-12-16 11:17:51.0
c语言基础"如何用星号画出一个矩形?"
刚刚开始学C,遇到一个用星号画矩形的例子,编出程序却运行不了,不知道是哪出了毛病,请各位大侠指点迷津,下面是我编出的程序:
/* 用*号画一个矩形 */
#include "stdio.h"
int main(void)
{
int len,hollow,i;
printf("Please input the length of the square:");
scanf("%d",&len);
for(i = 0;i ! = len;++i)
{
putchar('*');
}
putchar('\n');
hollow = len - 2;
for(i = 0;i ! = hollow;++i)
{
int j;
putchar('*');
for(j = 0;j ! =hollow;++j)
{
putchar('');
}
printf("*\n"0;
}
for(i = 0;i ! = len;++i)
{
putchar('*');
}
putchar('n');
return 0;
}
搜索更多相关的解决方案: 星号  c语言  矩形  hollow  

----------------解决方案--------------------------------------------------------
#include "stdio.h"
int main(void)
{
int len,hollow,i;
printf("Please input the length of the square:");
scanf("%d",&len);
for(i=0;i!=len;i++)
{
putchar('*');
}
putchar('\n');
hollow = len - 2;
for(i=0;i!=hollow;i++)
{
int j;
putchar('*');
for(j=0;j!=hollow;j++)
{
putchar('');
}
printf("*\n");
}
for(i=0;i!=len;i++)
{
putchar('*');
}
putchar('\n');
return 0;
}
这个我调试了没问题!!!
----------------解决方案--------------------------------------------------------
  相关解决方案