C++速速解决洛谷P1000 超级玛丽游戏

C++速速解决洛谷P1000 超级玛丽游戏

洛谷P1000题目网址(需登录才可提交评测)
这题是给初学者练习printf函数的吧,我们来把它速速消灭掉!

#include <cstdio>
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;
}

为什么除了最后一行,每行末尾都是"\n\"?

其中,printf函数输出的字符串后面加个转义字符“\”就可以在下一行接着写,不过这样的话就会接在上一行之后,所以每行加上“\n(转义字符,换行)\”才对。

猜你喜欢

转载自blog.csdn.net/MRH0420/article/details/109933357
今日推荐