for循环打印图形
其中必须有intmain(){drawRoom(2,2,0,1);drawRoom(5,3,1,2);drawRoom(14,8,8,5);getchar();retur...
其中必须有int main() {drawRoom(2,2,0,1);drawRoom(5,3,1,2);drawRoom(14,8,8,5);getchar();return 0;}
展开
2个回答
展开全部
编写程序如下:仅供参考
#include <stdio.h>
void drawRoom(int col, int row, int pcol, int prow)
{
int i, j;
printf("%dx%d room,player at %d,%d:\n", col, row, pcol, prow);
printf("+");
for (i = 0; i < col; ++i)
printf("-");
printf("+\n");
for (i = 0; i < row; ++i){
printf("|");
for (j = 0; j < col; ++j){
if (i == prow&&j == pcol)
printf("@");
else printf(".");
}
printf("|\n");
}
printf("+");
for (i = 0; i < col; ++i)
printf("-");
printf("+\n");
printf("\n");
}
int main() {
drawRoom(2, 2, 0, 1);
drawRoom(5, 3, 1, 2);
drawRoom(14, 8, 8, 5);
getchar();
return 0;
}
本回答被提问者和网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询