貌似有一个电视剧最近挺火的,论坛上到处都是爱心的教程,我就把自己几个月前做的表白方案发布一下。

先看效果:

不管你们觉得好不好看反正我觉得还行,【狗头】

上代码

希望各位可以找到自己的真爱!!!!!!!!

#include <stdio.h>
void delay(int sec) {time_t start_time, cur_time; // 变量声明time(&start_time);do {time(&cur_time);} while ((cur_time - start_time) < sec);
}
int main()
{int  i, j, k, l, m;char c = 3; for (i = 1; i <= 5; i++)    printf("\n"); for (i = 1; i <= 3; i++) { for (j = 1; j <= 32 - 2 * i; j++)  printf(" "); for (k = 1; k <= 4 * i + 1; k++)  printf("%c", c);for (l = 1; l <= 13 - 4 * i; l++)  printf(" "); for (m = 1; m <= 4 * i + 1; m++)  printf("%c", c);printf("\n");  }for (i = 1; i <= 3; i++) { for (j = 1; j <= 24 + 1; j++)   printf(" "); for (k = 1; k <= 29; k++)   printf("%c", c);printf("\n"); }printf("              浮世三千,吾爱有三,日月与卿日为朝,月为暮, 卿为朝朝暮暮 ");printf("\n");for (i = 7; i >= 1; i--) { for (j = 1; j <= 40 - 2 * i; j++)  printf(" "); for (k = 1; k <= 4 * i - 1; k++)  printf("%c", c);printf("\n"); }for (i = 1; i <= 39; i++)    printf(" ");printf("%c\n", c);  for (i = 1; i <= 5; i++)    printf("\n"); delay(3);printf("int day;\n");printf("for (day = 0; day <= mylife; day++)\n");printf("printf('我爱你')\n");return 0;
}

再来个高阶版

这个就是最近很火的电视剧那个,但这个是JAVA的,学C语言的小伙伴们还是不要想了,

我尝试用C语言做个相类似的结果没成功,还是好好学完C去学JAVA吧。

<!DOCTYPE html>
<html><head><title></title><script src="js/jquery.min.js"></script></head><style>* {padding: 0;margin: 0;}html,body {height: 100%;padding: 0;margin: 0;background: #000;}.aa {position: fixed;left: 50%;bottom: 10px;color: #ccc;}.container {width: 100%;height: 100%;}canvas {z-index: 99;position: absolute;width: 100%;height: 100%;}</style><body><!-- 樱花 --><div id="jsi-cherry-container" class="container"><audio autoplay="autopaly"><source src="renxi.mp3" type="audio/mp3" /></audio><img class="img" src="./123.png" alt="" /><!-- 爱心 --><canvas id="pinkboard" class="container"> </canvas></div></body>
</html>
<script>/** Settings*/var settings = {particles: {length: 500, // maximum amount of particlesduration: 2, // particle duration in secvelocity: 100, // particle velocity in pixels/seceffect: -0.75, // play with this for a nice effectsize: 30, // particle size in pixels},};(function () {var b = 0;var c = ["ms", "moz", "webkit", "o"];for (var a = 0; a < c.length && !window.requestAnimationFrame; ++a) {window.requestAnimationFrame = window[c[a] + "RequestAnimationFrame"];window.cancelAnimationFrame =window[c[a] + "CancelAnimationFrame"] ||window[c[a] + "CancelRequestAnimationFrame"];}if (!window.requestAnimationFrame) {window.requestAnimationFrame = function (h, e) {var d = new Date().getTime();var f = Math.max(0, 16 - (d - b));var g = window.setTimeout(function () {h(d + f);}, f);b = d + f;return g;};}if (!window.cancelAnimationFrame) {window.cancelAnimationFrame = function (d) {clearTimeout(d);};}})();/** Point class*/var Point = (function () {function Point(x, y) {this.x = typeof x !== "undefined" ? x : 0;this.y = typeof y !== "undefined" ? y : 0;}Point.prototype.clone = function () {return new Point(this.x, this.y);};Point.prototype.length = function (length) {if (typeof length == "undefined")return Math.sqrt(this.x * this.x + this.y * this.y);this.normalize();this.x *= length;this.y *= length;return this;};Point.prototype.normalize = function () {var length = this.length();this.x /= length;this.y /= length;return this;};return Point;})();/** Particle class*/var Particle = (function () {function Particle() {this.position = new Point();this.velocity = new Point();this.acceleration = new Point();this.age = 0;}Particle.prototype.initialize = function (x, y, dx, dy) {this.position.x = x;this.position.y = y;this.velocity.x = dx;this.velocity.y = dy;this.acceleration.x = dx * settings.particles.effect;this.acceleration.y = dy * settings.particles.effect;this.age = 0;};Particle.prototype.update = function (deltaTime) {this.position.x += this.velocity.x * deltaTime;this.position.y += this.velocity.y * deltaTime;this.velocity.x += this.acceleration.x * deltaTime;this.velocity.y += this.acceleration.y * deltaTime;this.age += deltaTime;};Particle.prototype.draw = function (context, image) {function ease(t) {return --t * t * t + 1;}var size = image.width * ease(this.age / settings.particles.duration);context.globalAlpha = 1 - this.age / settings.particles.duration;context.drawImage(image,this.position.x - size / 2,this.position.y - size / 2,size,size);};return Particle;})();/** ParticlePool class*/var ParticlePool = (function () {var particles,firstActive = 0,firstFree = 0,duration = settings.particles.duration;function ParticlePool(length) {// create and populate particle poolparticles = new Array(length);for (var i = 0; i < particles.length; i++)particles[i] = new Particle();}ParticlePool.prototype.add = function (x, y, dx, dy) {particles[firstFree].initialize(x, y, dx, dy);// handle circular queuefirstFree++;if (firstFree == particles.length) firstFree = 0;if (firstActive == firstFree) firstActive++;if (firstActive == particles.length) firstActive = 0;};ParticlePool.prototype.update = function (deltaTime) {var i;// update active particlesif (firstActive < firstFree) {for (i = firstActive; i < firstFree; i++)particles[i].update(deltaTime);}if (firstFree < firstActive) {for (i = firstActive; i < particles.length; i++)particles[i].update(deltaTime);for (i = 0; i < firstFree; i++) particles[i].update(deltaTime);}// remove inactive particleswhile (particles[firstActive].age >= duration &&firstActive != firstFree) {firstActive++;if (firstActive == particles.length) firstActive = 0;}};ParticlePool.prototype.draw = function (context, image) {// draw active particlesif (firstActive < firstFree) {for (i = firstActive; i < firstFree; i++)particles[i].draw(context, image);}if (firstFree < firstActive) {for (i = firstActive; i < particles.length; i++)particles[i].draw(context, image);for (i = 0; i < firstFree; i++) particles[i].draw(context, image);}};return ParticlePool;})();/** Putting it all together*/(function (canvas) {var context = canvas.getContext("2d"),particles = new ParticlePool(settings.particles.length),particleRate =settings.particles.length / settings.particles.duration, // particles/sectime;// get point on heart with -PI <= t <= PIfunction pointOnHeart(t) {return new Point(160 * Math.pow(Math.sin(t), 3),130 * Math.cos(t) -50 * Math.cos(2 * t) -20 * Math.cos(3 * t) -10 * Math.cos(4 * t) +25);}// creating the particle image using a dummy canvasvar image = (function () {var canvas = document.createElement("canvas"),context = canvas.getContext("2d");canvas.width = settings.particles.size;canvas.height = settings.particles.size;// helper function to create the pathfunction to(t) {var point = pointOnHeart(t);point.x =settings.particles.size / 2 +(point.x * settings.particles.size) / 350;point.y =settings.particles.size / 2 -(point.y * settings.particles.size) / 350;return point;}// create the pathcontext.beginPath();var t = -Math.PI;var point = to(t);context.moveTo(point.x, point.y);while (t < Math.PI) {t += 0.01; // baby steps!point = to(t);context.lineTo(point.x, point.y);}context.closePath();// create the fillcontext.fillStyle = "#ea80b0";context.fill();// create the imagevar image = new Image();image.src = canvas.toDataURL();return image;})();// render that thing!function render() {// next animation framerequestAnimationFrame(render);// update timevar newTime = new Date().getTime() / 1000,deltaTime = newTime - (time || newTime);time = newTime;// clear canvascontext.clearRect(0, 0, canvas.width, canvas.height);// create new particlesvar amount = particleRate * deltaTime;for (var i = 0; i < amount; i++) {var pos = pointOnHeart(Math.PI - 2 * Math.PI * Math.random());var dir = pos.clone().length(settings.particles.velocity);particles.add(canvas.width / 2 + pos.x,canvas.height / 2 - pos.y,dir.x,-dir.y);}// update and draw particlesparticles.update(deltaTime);particles.draw(context, image);}// handle (re-)sizing of the canvasfunction onResize() {canvas.width = canvas.clientWidth;canvas.height = canvas.clientHeight;}window.onresize = onResize;// delay rendering bootstrapsetTimeout(function () {onResize();render();}, 10);})(document.getElementById("pinkboard"));</script><script>var RENDERER = {INIT_CHERRY_BLOSSOM_COUNT: 30,MAX_ADDING_INTERVAL: 10,init: function () {this.setParameters();this.reconstructMethods();this.createCherries();this.render();if (navigator.userAgent.match(/(phone|pod|iPhone|iPod|ios|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i)) {// var box = document.querySelectorAll(".box")[0];// console.log(box, "移动端");// box.style.marginTop = "65%";}},setParameters: function () {this.$container = $("#jsi-cherry-container");this.width = this.$container.width();this.height = this.$container.height();this.context = $("<canvas />").attr({ width: this.width, height: this.height }).appendTo(this.$container).get(0)var rate = this.FOCUS_POSITION / (this.z + this.FOCUS_POSITION),x = this.renderer.width / 2 + this.x * rate,y = this.renderer.height / 2 - this.y * rate;return { rate: rate, x: x, y: y };},re}} else {this.phi += Math.PI / (axis.y == this.thresholdY ? 200 : 500);this.phi %= Math.PI;}if (this.y <= -this.renderer.height * this.SURFACE_RATE) {this.x += 2;this.y = -this.renderer.height * this.SURFACE_RATE;} else {this.x += this.vx;this.y += this.vy;}return (this.z > -this.FOCUS_POSITION &&this.z < this.FAR_LIMIT &&this.x < this.renderer.width * 1.5);},};$(function () {RENDERER.init();});</script>

接下来的几个就是C语言低配版了,我自己做的时候都觉的尬。

#include <stdio.h>
#include <math.h>
#include <windows.h>
#include <tchar.h>float f(float x, float y, float z) {float a = x * x + 9.0f / 4.0f * y * y + z * z - 1;return a * a * a - x * x * z * z * z - 9.0f / 80.0f * y * y * z * z * z;
}float h(float x, float z) {for (float y = 1.0f; y >= 0.0f; y -= 0.001f)if (f(x, y, z) <= 0.0f)return y;return 0.0f;
}int main() {SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),0xc);//SetConsoleTextAttribute()是Windows系统中一个可以设置控制台窗口字体颜色和背景色的计算机函数HANDLE o = GetStdHandle(STD_OUTPUT_HANDLE);// GetStdHandle()检索指定标准设备的句柄(标准输入、标准输出或标准错误)_TCHAR buffer[25][80] = { _T(' ') };_TCHAR ramp[] = _T("vvvvvvvv");int count = 0;int count1 = 0;for (float t = 0.0f;; t += 0.1f) {int sy = 0;float s = sinf(t);float a = s * s * s * s * 0.2f;for (float z = 1.3f; z > -1.2f; z -= 0.1f) {_TCHAR *p = &buffer[sy++][0];float tz = z * (1.2f - a);for (float x = -1.5f; x < 1.5f; x += 0.05f) {float tx = x * (1.2f + a);float v = f(tx, 0.0f, tz);if (v <= 0.0f) {float y0 = h(tx, tz);float ny = 0.01f;float nx = h(tx + ny, tz) - y0;float nz = h(tx, tz + ny) - y0;float nd = 1.0f / sqrtf(nx * nx + ny * ny + nz * nz);float d = (nx + ny - nz) * nd * 0.5f + 0.5f;*p++ = ramp[(int)(d * 5.0f)];} else*p++ = ' ';}}for (sy = 0; sy < 25; sy++) {COORD coord = { 0, sy };SetConsoleCursorPosition(o, coord);//作用是设置控制台(cmd)光标位置WriteConsole(o, buffer[sy], 79, NULL, 0);//从当前光标位置开始,将字符串写入控制台屏幕缓冲区}if (count <= 22) {printf("I Love You") ;//表白内容printf("            To CSDN");// 被表白者的名字count++;} else {printf("You Are My Best Lover.\n");count++;if (count >= 44) {count = 0;}}Sleep(36);//Sleep函数:执行挂起一段时间,也就是等待一段时间在继续执行}
}

最后参考了一个教程做了个我认为效果还不错的

#include <stdio.h>
#include <math.h>
#include <windows.h>
#include <tchar.h>float f(float x, float y, float z) {
float a = x * x + 9.0f / 4.0f * y * y + z * z - 1;
return a * a * a - x * x * z * z * z - 9.0f / 80.0f * y * y * z * z * z;
}float h(float x, float z) {for (float y = 1.0f; y >= 0.0f; y -= 0.001f)
if (f(x, y, z) <= 0.0f)
return y;
return 0.0f;
}int main() {
HANDLE o = GetStdHandle(STD_OUTPUT_HANDLE);
_TCHAR buffer[25][80] = { _T(' ') };
_TCHAR ramp[] = _T(".:-=+*#%@");for (float t = 0.0f;; t += 0.1f) {int sy = 0;float s = sinf(t);float a = s * s * s * s * 0.2f;for (float z = 1.3f; z > -1.2f; z -= 0.1f) {_TCHAR* p = &buffer[sy++][0];float tz = z * (1.2f - a);for (float x = -1.5f; x < 1.5f; x += 0.05f) {float tx = x * (1.2f + a);float v = f(tx, 0.0f, tz);if (v <= 0.0f) {float y0 = h(tx, tz);float ny = 0.01f;float nx = h(tx + ny, tz) - y0;float nz = h(tx, tz + ny) - y0;float nd = 1.0f / sqrtf(nx * nx + ny * ny + nz * nz);float d = (nx + ny - nz) * nd * 0.5f + 0.5f;*p++ = ramp[(int)(d * 5.0f)];
}
else*p++ = ' ';
}
}for (sy = 0; sy < 25; sy++) {COORD coord = { 0, sy };SetConsoleCursorPosition(o, coord);WriteConsole(o, buffer[sy], 79, NULL, 0);
}
Sleep(33);
}
}

————————————————

最后最后看到一个还不错的,但是他的代码总觉得怪怪的,在我的VS2022上跑了一遍有好多的系统错误,应该用VS2010没问题。哪个大佬帮我解惑一下。

#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#define I 20
#define R 340
#include <string.h>
int main() {char answer[10];printf("遇到你\n我才发现\n");printf("有趣的灵魂\n我喜欢你,答应我吧!\n输入520\n");scanf("%s", answer);char b[4] = "520";if (strcmp(answer, b) == 0) {float y, x, z, f;for (y = 1.5f; y > -1.5f; y -= 0.1f) {for (x = -1.5f; x < 1.5f; x += 0.05f) {z = x * x + y * y - 1;f = z * z * z - x * x * y * y * y;putchar(f <= 0.0f ? "*********"[(int)(f * -8.0f)] : ' ');}putchar('\n');}long time;for (;;) {system("color a");for (time = 0; time < 99999999; time++);system("color b");for (time = 0; time < 99999999; time++);system("color c");for (time = 0; time < 99999999; time++);system("color d");for (time = 0; time < 99999999; time++);system("color e");for (time = 0; time < 99999999; time++);system("color f");for (time = 0; time < 99999999; time++);system("color 0");for (time = 0; time < 99999999; time++);system("color 1");for (time = 0; time < 99999999; time++);system("color 2");for (time = 0; time < 99999999; time++);system("color 3");for (time = 0; time < 99999999; time++);system("color 4");for (time = 0; time < 99999999; time++);system("color 5");for (time = 0; time < 99999999; time++);system("color 6");for (time = 0; time < 99999999; time++);system("color 7");for (time = 0; time < 99999999; time++);system("color 8");for (time = 0; time < 99999999; time++);system("color 9");}getchar();} else {printf("\n好吧!\n");}return 0;
}————————————————
版权声明:本文为CSDN博主「kckckckckckc__」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/m0_73473745/article/details/127139305

各位单身狗的福音:表白爱心魔改版相关推荐

  1. 喜欢一个人怎么去表白?教你七招彻底摆脱单身狗

    喜欢一个人怎么去表白?教你七招彻底摆脱单身狗. 如果你喜欢上一个人,该怎样对他表白呢?该怎样表达出你真正的心意呢?你可能想过去表白,可是却不知道该从何说起.其实表白成功与否都无妨,但你要保持一个正确的 ...

  2. javascript研发唯美表白神器,程序猿不做单身狗!

    点击查看特效动图 做一个浪漫的程序猿,迎娶女神不是梦 基础课题:HTML5/javascript炫丽的爱心飘落 知识点:html/css布局思维,css浮动.定位盒模型, css伪类的灵活运用,jav ...

  3. 16万Facebook数据告诉你,单身狗更爱养猫

    导读 大龄单身女性更爱养猫?养狗的人更加外向?养猫的人更高冷?阿猫阿狗主人的数据分析,前方大批萌图袭来,有毒慎入! 你是一个爱猫人士还是爱狗人士?为了纪念8月8日国际猫咪节(抱歉了,各位狗狗们),我们 ...

  4. 数据拯救单身狗!助攻两性相处的6个小数据

    感谢关注天善智能,走好数据之路↑↑↑ 欢迎关注天善智能,我们是专注于商业智能BI,人工智能AI,大数据分析与挖掘领域的垂直社区,学习,问答.求职一站式搞定! 对商业智能BI.大数据分析挖掘.机器学习, ...

  5. 牛客14350 苦逼的单身狗

    链接:https://ac.nowcoder.com/acm/problem/14350 来源:牛客网 时间限制:C/C++ 1秒,其他语言2秒 空间限制:C/C++ 32768K,其他语言65536 ...

  6. 七夕关爱单身狗程序猿:4本书给你一个完整的脱单秘籍

    导读:今天,数据叔要关爱一下单身狗中的程序猿,当然,也可以说关爱一下程序猿中的单身狗,看起来有点动物园-- 别错过,文末有福利! 身为一个程序猿单身狗,在即将到来的明天可能面对的情况是介样婶儿滴! 也 ...

  7. python画狗_Python 画一只单身狗作为情人节礼物

    image.png 1.说点什么 今天是情人节,在五道口技校有npy的人是幸福的,因为对方可以帮忙换屏幕.拆电脑.修电视.换灯泡--五道口技校的单身狗也是幸福的,因为不用帮一个npy调板子.写数学.d ...

  8. 俄语考生学计算机难吗,俄语说的不好,没有计算机证书,甚至还是单身狗,怎么办?...

    原标题:俄语说的不好,没有计算机证书,甚至还是单身狗,怎么办? 不怎么办,就努力活着. 俄语说的不好,若你想说好就努力. 没有计算机证书,若你想有就去考. 若努力了结果依然不尽人意 平庸才是人生的真谛 ...

  9. 送给单身猿们的表白神器

    问天下男生,有谁想单身?又有谁想单身一辈子? 虽然本人也是单身狗,但是也是有一个远大的理想,哈哈,大白天的我又开始做梦了 找到一个好看的网页的时候就把它收藏下来了,但是后来觉得不爽,为什么我不能把它抠 ...

最新文章

  1. 发掘数据中的信息 -- 数据探索之描述性统计
  2. 台湾大学林轩田机器学习基石课程学习笔记14 -- Regularization
  3. oracle high watermark,Elasticsearch high disk watermark 问题
  4. 零基础学前端开发技术之第七章 浮动塌陷
  5. 理解依赖注入(IOC)和学习Unity
  6. 【智能车Code review】——小S与中S道路判断
  7. python中多重if语句用法_Python多分支if语句的使用
  8. java批量执行多条Sql语句
  9. 信息学奥赛一本通 1324:【例6.6】整数区间
  10. SAS学习笔记之《SAS编程与数据挖掘商业案例》(3)变量操作、观测值操作、SAS数据集管理...
  11. 基于 Docker 中的 MongoDB 授权使用
  12. 5年做100款游戏是什么体验?“高产”开发者的10条心得
  13. 发现Chrome小恐龙彩蛋的第n+1个使用者
  14. 论文--Learning to Predict Bus Arrival Time From Heterogeneous Measurements via Recurrent Neural Networ
  15. 抱薪者说 | 君莫:穿越山海,终成“C链小雷锋”
  16. shell 中#!/bin/sh 的意思
  17. android 一分钟倒计时动画,Android View篇之启动页倒计时动画的实现
  18. C语言入门——初识C语言
  19. 个人项目----吴华文
  20. ModelSim illegal reference to net “***“ 报错问题解决

热门文章

  1. 一般博士毕业能进什么样的高校当老师?网友:看第一学历!
  2. 配合好OpenStack和开源MANO,就能部署好NFV
  3. 21个MySQL表设计的经验准则
  4. BP神经网络隐含层节点数的确定
  5. iOS 3DES加密解密(一行代码搞定)
  6. Windows 10 各版本
  7. 泛微考勤加班流程,有重复的时间段不让提交
  8. 树莓派串口通信python,【树莓派Pico测评】- AD采集示例及串口通信
  9. 零基础如何学习 Web 安全?
  10. excel 合并多个工作表,保留列宽等格式