`#include
include
void printBanner();
void printHeart();
void printFlower();
int main() {
std::cout << "\n";
printBanner();
std::cout << std::endl;
printFlower(); std::cout << std::endl;
printHeart();return 0;
}`
点击查看代码
void printBanner() {std::cout << "****************************************\n";std::cout << "* *\n";std::cout << "* Happy Teacher's Day! *\n";std::cout << "* *\n";std::cout << "* Thank you for your dedication and *\n";std::cout << "* hard work. May your life be filled *\n";std::cout << "* with joy and success. *\n";std::cout << "* tian hui zhen (shazi) *\n";std::cout << "****************************************\n";
}
点击查看代码
void printHeart() {float x, y, a;for (y = 1.5f; y > -1.5f; y -= 0.1f) {for (x = -1.5f; x < 1.5f; x += 0.05f) {a = x * x + y * y - 1;std::cout << ((a * a * a - x * x * y * y * y) <= 0.0f ? "*" : " ");}std::cout << std::endl;}
}
点击查看代码
void printFlower() {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 << "****************************************\n";
}