新年福字

#include<iostream>
using namespace std;
int main()
{
	int i,j;
	//上三角形
	for (i = 1; i <= 5; i++)
	{
		//三角形左部分
		for(j=5-i+5;j>0;j--)
		cout <<"  ";
		cout << "福";
		for (j = i - 1; j > 0; j--)
			cout << "  ";
		//三角形右部分
		for (j = i - 1; j > 0; j--)
			cout << "  ";
		cout << "福";
		for (j = 5 - i; j > 0; j--)
			cout << "  ";
		cout << endl;
	}
	//中间(上五行部分)
	for (i = 1; i <= 5; i++)
	{
		//左侧三角形
		for (j = 1; j <= 5 - i; j++)
			cout << "  ";
		cout << "福";
		for (j = i - 1; j > 0; j--)
			cout << "  ";
		//福字部分
		switch (i)
		{
		case 1:cout << "  *      H A P P Y "; break;
		case 2:cout << "    *      N E W   "; break;
		case 3:cout << "牛年大吉  Y     !  "; break;
		case 4:cout << "    快     E A R   "; break;
		case 5:cout << "  春C 乐   新牛似  "; break;
		
		};
		for (j = i - 1; j > 0; j--)
			cout << "  ";
		cout << " 福" << endl;
	}
	//中间(下四行部分)
	for (i = 1; i <= 4; i++)
	{
		for (j = i; j > 0; j--)
			cout << "  ";
		cout << "福";
		for (j = 4 - i; j > 0; j--)
			cout << "  ";
		switch (i)
		{
		case 1:cout << "新  H    春  0   象"; break;
		case 2:cout << "    I    * 2 * 2 * "; break;
		case 3:cout << "    N    盛  1   牛"; break;
		case 4:cout << "    A      世国腾  "; break;
		};
		for (j = 4 - i; j > 0; j--)
			cout << "  ";
		cout << " 福"<<endl;
	}
	//下三角
	for (i = 1; i <= 5; i++)
	{
		for (j = i - 1+5; j > 0; j--)
			cout << "  ";
		cout << "福";
		for (j = (5 - i)*2; j > 0; j--)
			cout << "  ";
		cout << "福" << endl;
	}
}


在这里插入图片描述

  • 2
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值