用C++写一个张三生日快乐的爱心代码
时间: 2025-01-27 22:11:47 浏览: 43
以下是一个用C++编写的在控制台输出"张三生日快乐"的爱心图案的代码:
```cpp
#include <iostream>
#include <string>
using namespace std;
int main() {
string name = "张三";
cout << " *** *** " << endl;
cout << " ***** ***** " << endl;
cout << "******* *******" << endl;
cout << " ************* " << endl;
cout << " *********** " << endl;
cout << " ********* " << endl;
cout << " ***** " << endl;
cout << " * " << endl;
cout << " " << endl;
cout << " 祝" << name << "生日快乐! " << endl;
cout << " " << endl;
return 0;
}
```
这段代码会输出一个由星号组成的爱心图案,并在爱心下方显示"祝张三生日快乐!"的祝福语。你可以将`name`变量的值改为任何你想要祝福的人的名字。
阅读全文
相关推荐
















