命令行窗口输出图案

#include "Graphic_fun.h"

/* 功能:输出为
		#
	   # #
	  #   #
	 #     #
	  #   #
	   # #
		#
*/

UINT32 Graphic_prismatic1(
	   UINT32 u32_line,
	   CHAR i8_m
	   )

{
	UINT32 u32_i = 0u, u32_j = 0u;
	/* 上半部分 */
	for ( u32_i = 1u; u32_i <= u32_line; u32_i++)
	{
		for (u32_j = 1u; u32_j <= (u32_line + u32_i); u32_j++)
		{
			if ((u32_j== ((u32_line + 1u) -u32_i))|| (u32_j == ((u32_line - 1u) + u32_i)))
			{
				if ( NULL != i8_m)
				{
					(void)OSM_Printf("%c", i8_m);
				}
			}
			else
			{
				(void)OSM_Printf(" ");
			}
		}
		(void)OSM_Printf("\n");
	}
	/* 下半部分 */
	for ( u32_i = 1u; u32_i < u32_line; u32_i++)
	{
		for (u32_j = 1u; u32_j < ((2u * u32_line) - 1u); u32_j++)
		{
			if ( (u32_j == (u32_i + 1u)) ||( u32_j == ((2u * u32_line) - 1u -u32_i)))
			{
				if ( NULL != i8_m)
				{
					(void)OSM_Printf("%c",i8_m);
				}
			}
			else
			{
				(void)OSM_Printf(" ");
			}
		}
		(void)OSM_Printf("\n");
	}
	return 0u;
}

/* 打印出实心的棱形 */
UINT32 

你可能感兴趣的:(嵌入式入门,C语言)