这真是一个十分悲伤的故事,虽然我不打算删文章,但是,建议看到它的人不要再做这种尝试了
/*某个ZZ打算送女孩纸的,因为她只会C,电脑里也不可能会有graphics.h这样的图形库,想要在里面显示些图片当背景不大现实。但我现在觉着吧,像我这样的似乎很没前途,哎,需要的自取*/
/*********************************
happy birthday
生日贺卡 & 蛋糕
—— 方
2019/1/7
唱歌不好听,不能像你一样唱生日快送人,只能送点别的了
************************************/
#include
#include
#include
#include
//变量区
extern char s_1[] = { "☆ 我为你收集了编程的美,放在你生日的烛台上 。 " };
extern char s_2[] = { "☆ 将想说的话都藏在花蕾里,让它成为待放的秘密。 " };//
extern char s_3[] = { "☆ 呐,给你一个小蛋糕 " };
extern char s_4[] = { "☆ 祝你生日快乐啦 ! " };
extern char s_5[] = { "☆ )\ " };
extern char s_6[] = { "☆ / ) " };
extern char s_7[] = { "☆ '_' " };
extern char s_8[] = { "☆ . | . " };
extern char s_9[] = { "☆ . | . " };
extern char s_10[] = { "☆ | @ | " };
extern char s_11[] = { "☆ .---------- - | @ |---------- - . " };
extern char s_12[] = { "☆ . / : | @ | : \. " };
extern char s_13[] = { "☆ | happy birthday!| " };
extern char s_14[] = { "☆ 生日快乐 " };
extern char s_15[] = { "☆ | '-------------------------' | " };
extern char s_16[] = { "☆ | x % % % % % x | " };
extern char s_17[] = { "☆ | x %% %% %% %% %% %% %% %% x | " };
extern char s_18[] = { "☆ | % % % % % % | " };
extern char s_19[] = { "☆ | + + | " };
extern char s_20[] = { "☆ | # # # # # # # # # # | " };
extern char s_21[] = { "☆ \\ / " };
extern char s_22[] = { "☆ '-------------------------------' " };
extern char s_23[] = { "☆ ——方" };
extern char s_24[] = { "☆ 2019.01.10" };
extern char * ssum[] = { s_1,s_2,s_3,s_4,s_5,s_6,s_7,s_8,s_9,s_10,s_11,s_12,s_13,s_14,s_15,s_16,s_17,s_18,s_19 ,s_20,s_21,s_22,s_23 ,s_24 };
//函数区
void delay();
void delay1();
void xinxing();
void main()
{
int i = 0;
system("cls");
system("color c0");
puts("\nTo ##:\n\n\n");
delay();
for (i = 0; i<4; i++)
{
puts(*(ssum + i));
delay();
}
for (i = 4; i<24; i++)
{
puts(*(ssum + i));
delay1();
}
//delay();
//xinxing();
getchar();
}
void delay()
{
long f = 0;
while (f<214748325)
{
f = f + 1;
f = f - 1;
f = f + 1;
}
}
void delay1()
{
long f = 0;
while (f<21474832)
{
f = f + 1;
f = f - 1;
f = f + 1;
}
}
void xinxing()//,,,,,,,,,,,,,,,,,,,,,,,,,,
{
int line1, line3, line4; //控制行数
int space1, space2, space4, space5; //控制空格
int star1, star2, star3, star4; //控制星号
for (line1 = 1; line1 <= 2; line1++)
{
for (space1 = 1; space1 <= (7 - 2 * line1); space1++)
{
printf(" ");
}
for (star1 = 1; star1 <= (4 * line1 + 2); star1++)
{
printf("*");
}
for (space1 = 1; space1 <= (11 - 4 * line1); space1++)
{
printf(" ");
}
for (star1 = 1; star1 <= (4 * line1 + 2); star1++)
{
printf("*");
}
printf("\n");
}
// 以上循环输出前2行
{
{ printf(" "); }
for (space2 = 1; space2 <= 13; space2++)
{
printf("*");
}
{ printf(" "); }
for (star2 = 1; star2 <= 13; star2++)
{
printf("*");
}
printf("\n");
}
// 以上大括号内的代码输出第3行
for (line3 = 1; line3 <= 3; line3++)
{
for (star3 = 1; star3 <= 29; star3++)
{
printf("*");
}
printf("\n");
}
// 以上循环输出4、5、6行(就是相等长度的三条)
for (line4 = 1; line4 <= 7; line4++)
{
for (space4 = 1; space4 <= (2 * line4 - 1); space4++)
{
printf(" ");
}
for (star4 = 1; star4 <= (31 - line4 * 4); star4++)
{
printf("*");
}
printf("\n");
}
// 以上循环输出7到13行
for (space5 = 1; space5 <= 14; space5++)
{
printf(" ");
}
printf("*");
printf("\n");
getchar();
}
//找到一朵贼好看的玫瑰
出自出自http://www.romancortes.com/blog/1k-rose/
#include
#include
#include
//出自http://www.romancortes.com/blog/1k-rose/
//
// 定义全局变量
int rosesize = 500;
int h = -250;
// 定义结构体
struct DOT
{
double x;
double y;
double z;
double r; // 红色
double g; // 绿色
// b(蓝色) 通过 r 计算
};
// 计算点
bool calc(double a, double b, double c, DOT &d)
{
double j, n, o, w, z;
if (c > 60) // 花柄
{
d.x = sin(a * 7) * (13 + 5 / (0.2 + pow(b * 4, 4))) - sin(b) * 50;
d.y = b * rosesize + 50;
d.z = 625 + cos(a * 7) * (13 + 5 / (0.2 + pow(b * 4, 4))) + b * 400;
d.r = a * 1 - b / 2;
d.g = a;
return true;
}
double A = a * 2 - 1;
double B = b * 2 - 1;
if (A * A + B * B < 1)
{
if (c > 37) // 叶
{
j = (int(c) & 1);
n = j ? 6 : 4;
o = 0.5 / (a + 0.01) + cos(b * 125) * 3 - a * 300;
w = b * h;
d.x = o * cos(n) + w * sin(n) + j * 610 - 390;
d.y = o * sin(n) - w * cos(n) + 550 - j * 350;
d.z = 1180 + cos(B + A) * 99 - j * 300;
d.r = 0.4 - a * 0.1 + pow(1 - B * B, -h * 6) * 0.15 - a * b * 0.4 + cos(a + b) / 5 + pow(cos((o * (a + 1) + (B > 0 ? w : -w)) / 25), 30) * 0.1 * (1 - B * B);
d.g = o / 1000 + 0.7 - o * w * 0.000003;
return true;
}
if (c > 32) // 花萼
{
c = c * 1.16 - 0.15;
o = a * 45 - 20;
w = b * b * h;
z = o * sin(c) + w * cos(c) + 620;
d.x = o * cos(c) - w * sin(c);
d.y = 28 + cos(B * 0.5) * 99 - b * b * b * 60 - z / 2 - h;
d.z = z;
d.r = (b * b * 0.3 + pow((1 - (A * A)), 7) * 0.15 + 0.3) * b;
d.g = b * 0.7;
return true;
}
// 花
o = A * (2 - b) * (80 - c * 2);
w = 99 - cos(A) * 120 - cos(b) * (-h - c * 4.9) + cos(pow(1 - b, 7)) * 50 + c * 2;
z = o * sin(c) + w * cos(c) + 700;
d.x = o * cos(c) - w * sin(c);
d.y = B * 99 - cos(pow(b, 7)) * 50 - c / 3 - z / 1.35 + 450;
d.z = z;
d.r = (1 - b / 1.2) * 0.9 + a * 0.1;
d.g = pow((1 - b), 20) / 4 + 0.05;
return true;
}
return false;
}
// 主函数
void main()
{
// 定义变量
short *zBuffer;
int x, y, z, zBufferIndex;
DOT dot;
// 初始化
initgraph(640, 480); // 创建绘图窗口
setbkcolor(WHITE); // 设置背景色为白色
cleardevice(); // 清屏
// 初始化 z-buffer
zBuffer = new short[rosesize * rosesize];
memset(zBuffer, 0, sizeof(short) * rosesize * rosesize);
for (int j = 0; j < 2000 && !_kbhit(); j++) // 按任意键退出
{
for (int i = 0; i < 10000; i++) // 减少是否有按键的判断
if (calc(double(rand()) / RAND_MAX, double(rand()) / RAND_MAX, rand() % 46 / 0.74, dot))
{
z = int(dot.z + 0.5);
x = int(dot.x * rosesize / z - h + 0.5);
y = int(dot.y * rosesize / z - h + 0.5);
if (y >= rosesize) continue;
zBufferIndex = y * rosesize + x;
if (!zBuffer[zBufferIndex] || zBuffer[zBufferIndex] > z)
{
zBuffer[zBufferIndex] = z;
// 画点
int r = ~int((dot.r * h)); if (r < 0) r = 0; if (r > 255) r = 255;
int g = ~int((dot.g * h)); if (g < 0) g = 0; if (g > 255) g = 255;
int b = ~int((dot.r * dot.r * -80)); if (b < 0) b = 0; if (b > 255) b = 255;
putpixel(x + 50, y - 20, RGB(r, g, b));
}
}
Sleep(1);
}
// 退出
delete[]zBuffer;
_getch();
closegraph();
}