c++输出airqplane艺术字
时间: 2024-01-06 10:04:49 浏览: 55
好的,下面是一个简单的示例代码,可以输出“airplane”的艺术字效果:
```
#include <iostream>
using namespace std;
int main() {
cout << " __|__\n";
cout << " / \\\n";
cout << "( airplane )\n";
cout << " \\_,-,-_/\n";
return 0;
}
```
输出效果如下:
```
__|__
/ \
( airplane )
\_,-,-_/
```
当然,你也可以使用其他ASCII码来自定义艺术字。
相关问题
用c++显示艺术字
要在C++中显示艺术字,可以使用ASCII艺术字。ASCII艺术字是一种使用ASCII字符来制作艺术字的技术。
以下是一个简单的示例程序,可以在控制台中显示ASCII艺术字:
```c++
#include <iostream>
#include <string>
using namespace std;
int main() {
string art = R"(
_ ___ _ _ _
/_\ | _ \_ _ ___| (_) |
/ _ \| _/ '_/ _ \ | | |
/_/ \_\_| |_| \___/_|_|_|
)";
cout << art << endl;
return 0;
}
```
输出:
```
_ ___ _ _ _
/_\ | _ \_ _ ___| (_) |
/ _ \| _/ '_/ _ \ | | |
/_/ \_\_| |_| \___/_|_|_|
```
这个程序使用了R"()"语法,这是一个原始字符串字面值,允许我们在字符串中使用任何字符,包括换行符。在字符串中,我们使用空格、下划线、竖线等字符来制作艺术字。
devc++输出数字乱码
devc++输出数字乱码的原因可能是编码格式不匹配,可以尝试在程序开头添加以下代码来设置输出编码为UTF-8:
```c++
#include <iostream>
#include <locale.h>
#include <windows.h>
int main()
{
SetConsoleOutputCP(CP_UTF8);
setlocale(LC_ALL, "zh_CN.UTF-8");
// 此处添加你的代码
return 0;
}
```
另外,如果是在控制台中输出数字乱码,可以尝试使用 `wcout` 来输出,如下所示:
```c++
#include <iostream>
#include <io.h>
#include <fcntl.h>
int main()
{
_setmode(_fileno(stdout), _O_U16TEXT);
int num = 123;
std::wcout << num << std::endl;
return 0;
}
```
这样可以避免控制台输出数字乱码的问题。
相关推荐
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)