超级玛丽游戏

· · 题解

这道题就靠输出

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; }