其他分享
首页 > 其他分享> > 超级玛丽游戏

超级玛丽游戏

作者:互联网

P1002 超级玛丽游戏

题目链接

P1002 超级玛丽游戏

题解

没什么好说的,直接输出该字符画就好。这里介绍几种 C++ 常用的写法:

using namespace std;
int main()
{
	cout<<"                ********"<<endl;
	cout<<"               ************"<<endl;
	cout<<"               ####....#."<<endl;
	cout<<"             #..###.....##...."<<endl;
	cout<<"             ###.......######              ###            ###"<<endl;
	cout<<"                ...........               #...#          #...#"<<endl;
	cout<<"               ##*#######                 #.#.#          #.#.#"<<endl;
	cout<<"            ####*******######             #.#.#          #.#.#"<<endl;
	cout<<"           ...#***.****.*###....          #...#          #...#"<<endl;
	cout<<"           ....**********##.....           ###            ###"<<endl;
	cout<<"           ....****    *****...."<<endl;
	cout<<"             ####        ####"<<endl;
	cout<<"           ######        ######"<<endl;
	cout<<"##############################################################"<<endl;
	cout<<"#...#......#.##...#......#.##...#......#.##------------------#"<<endl;
	cout<<"###########################################------------------#"<<endl;
	cout<<"#..#....#....##..#....#....##..#....#....#####################"<<endl;
	cout<<"##########################################    #----------#"<<endl;
	cout<<"#.....#......##.....#......##.....#......#    #----------#"<<endl;
	cout<<"##########################################    #----------#"<<endl;
	cout<<"#.#..#....#..##.#..#....#..##.#..#....#..#    #----------#"<<endl;
	cout<<"##########################################    ############";
	return 0;
}

这种属于直接好几个 cout 函数输出,没啥技术含量,不讲。

int main()
{
    printf(
    "                ********\n"
    "               ************\n"
    "               ####....#.\n"
    "             #..###.....##....\n"
    "             ###.......######              ###            ###\n"
    "                ...........               #...#          #...#\n"
    "               ##*#######                 #.#.#          #.#.#\n"
    "            ####*******######             #.#.#          #.#.#\n"
    "           ...#***.****.*###....          #...#          #...#\n"
    "           ....**********##.....           ###            ###\n"
    "           ....****    *****....\n"
    "             ####        ####\n"
    "           ######        ######\n"
    "##############################################################\n"
    "#...#......#.##...#......#.##...#......#.##------------------#\n"
    "###########################################------------------#\n"
    "#..#....#....##..#....#....##..#....#....#####################\n"
    "##########################################    #----------#\n"
    "#.....#......##.....#......##.....#......#    #----------#\n"
    "##########################################    #----------#\n"
    "#.#..#....#..##.#..#....#..##.#..#....#..#    #----------#\n"
    "##########################################    ############\n"
    );
    return 0;
}

利用 printf 进行输出。多个字符串输出时会当做一个字符串输出。

标签:#.#.#,游戏,....,超级玛丽,#----------#,#...#,###
来源: https://www.cnblogs.com/Hszsfzoj/p/P1002.html