C++ 画矩形代码:实现空心或实心矩形
#include\x20
int\x20main()\x20{ \x20\x20int\x20height, width, solid; \x20\x20char symbol; \x20\x20cin\x20>>\x20height\x20>>\x20width\x20>>\x20symbol\x20>>\x20solid; \x20\x20 \x20\x20for\x20(int\x20i\x20=\x200;\x20i\x20<\x20height;\x20i++)\x20{ \x20\x20\x20\x20for\x20(int\x20j\x20=\x200;\x20j\x20<\x20width;\x20j++)\x20{ \x20\x20\x20\x20\x20\x20if\x20(i\x20==\x200\x20||\x20i\x20==\x20height-1\x20||\x20j\x20==\x200\x20||\x20j\x20==\x20width-1)\x20{ \x20\x20\x20\x20\x20\x20\x20\x20cout\x20<<\x20symbol; \x20\x20\x20\x20\x20\x20}else\x20if\x20(solid\x20==\x201)\x20{ \x20\x20\x20\x20\x20\x20\x20\x20cout\x20<<\x20symbol; \x20\x20\x20\x20\x20\x20}else\x20{ \x20\x20\x20\x20\x20\x20\x20\x20cout\x20<<\x20" "; \x20\x20\x20\x20\x20\x20} \x20\x20\x20\x20} \x20\x20\x20\x20cout\x20<<\x20endl; \x20\x20} \x20\x20 \x20\x20return\x200; }
原文地址: https://www.cveoy.top/t/topic/qiNu 著作权归作者所有。请勿转载和采集!