📜  rick astley - 永远不会放弃你 - C++ (1)

📅  最后修改于: 2023-12-03 15:04:54.386000             🧑  作者: Mango

Rick Astley - 永远不会放弃你 - C++

简介

这是一个用 C++ 编写的简单程序,演示了如何使用 ASCII 艺术在控制台窗口中输出 Rick Astley 的经典歌曲 "永远不会放弃你" 的歌词。

代码片段
#include <iostream>

int main()
{
    std::cout << " _______ _______ _______ _______ _______ _______ _______\n";
    std::cout << "|       |       |       |       |       |       |       |\n";
    std::cout << "|       |       |       |       |       |       |       |\n";
    std::cout << "|  ____ |  ____ |  ____ |  ____ |  ____ |  ____ |   ___ |\n";
    std::cout << "| |    || |    || |    || |    || |    || |    ||  |___||\n";
    std::cout << "| |____|| |____|| |____|| |____|| |____|| |____||_____ |\n";
    std::cout << "|_____||_____||_____||_____||_____||_____||_____|\n";
    std::cout << " _______ _______ _______ _______ _______ _______ _______\n";
    std::cout << "|       |       |       |       |       |       |       |\n";
    std::cout << "|       |       |       |       |       |       |       |\n";
    std::cout << "|  ____ |  ____ |  ____ |  ____ |  ____ |  ____ |   ___ |\n";
    std::cout << "| |    || |    || |    || |    || |    || |    ||  |___||\n";
    std::cout << "| |____|| |____|| |____|| |____|| |____|| |____||_____ |\n";
    std::cout << "|_____||_____||_____||_____||_____||_____||_____|\n";
    std::cout << " _____   _____   _____       _____         _      \n";
    std::cout << "|   __|_|     |_|  _  |___ ___|  |  |___ ___|_|___ ___ ___\n";
    std::cout << "|__   | . | | | |     |  _| -_|     | -_|  _| |   | -_|  _|\n";
    std::cout << "|_____|___|_|_|_|__|__|_| |___|__|__|___|_| |_|_|_|___|_|\n";
    std::cout << "\n";
    std::cout << "Never gonna give you up,\n";
    std::cout << "Never gonna let you down,\n";
    std::cout << "Never gonna run around and desert you.\n";
    std::cout << "Never gonna make you cry,\n";
    std::cout << "Never gonna say goodbye,\n";
    std::cout << "Never gonna tell a lie and hurt you.\n";
    return 0;
}
演示效果

运行程序,可以在控制台窗口中看到以下效果:

演示效果

解释说明

这段代码使用了 C++ 的标准输出流 std::cout,通过多次调用 << 运算符来输出一些 ASCII 艺术和歌词文本。每行末尾使用了换行符 \n 来输出换行。程序最后返回 0,表示正常退出。