跳到正文

题解

超级玛丽游戏

czy_1约 6 分钟
原文

这是 2026年3月7日 存档的第 1 版,不是当前版本。查看当前版本

文章信息与版本

文章信息

发布
2026年1月17日
收录
2026年3月7日
更新
2026年11月14日
篇幅
约 6 分钟
题目
P1000

版本

  1. v2当前
  2. v1

这道题就靠输出

cout分行输出(见下文) (不建议使用)

#include <iostream> 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 << ”########################################## ############” << endl; return 0; }

再推荐一个更实用的: c++常见多行输出法(printf)

#include<stdio.h> 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; }