写一个爱心的c++代码
时间: 2024-03-12 16:43:22 浏览: 75
用c++表达爱心(c++)
5星 · 资源好评率100%
下面是一个简单的C++代码,用星号打印出一个爱心的图案:
```c++
#include <iostream>
using namespace std;
int main() {
cout << " * *" << endl;
cout << " * * * *" << endl;
cout << "* * *" << endl;
cout << "* *" << endl;
cout << " * *" << endl;
cout << " * *" << endl;
cout << " * *" << endl;
cout << " *" << endl;
return 0;
}
```
输出结果:
```
* *
* * * *
* * *
* *
* *
* *
* *
*
```
阅读全文