基本信息
源码名称:C语言表白代码
源码大小:2.10KB
文件格式:.cpp
开发语言:C/C++
更新时间:2018-04-10
友情提示:(无需注册或充值,赞助后即可获取资源下载链接)
嘿,亲!知识可是无价之宝呢,但咱这精心整理的资料也耗费了不少心血呀。小小地破费一下,绝对物超所值哦!如有下载和支付问题,请联系我们QQ(微信同号):813200300
本次赞助数额为: 1 元×
微信扫码支付:1 元
×
请留下您的邮箱,我们将在2小时内将文件发到您的邮箱
源码介绍
C程序表白简单好用
程序员必备
#include <stdio.h>
#include <math.h>
#include <windows.h>
#include <string.h>
#define GFNAME "女友"
//女友的名字
#define U 0.1
#define V 0.057
#define M 1.1
#define N 1.2
/*自定义的表白函数*/
void showLove()
{
double x, y;
int i=0;
char WhatYouWantToSay[27][255]={
" "," "," "," ","亲爱的:",
"──────────────────",
"\t~\(≧▽≦)/~","──────────────────",
"\t你","──────────────────",
"\t终于来了","──────────────────",
"\t世界是黑暗的","──────────────────",
"\t唯有有你的地方才是光明",
"──────────────────","\t★我★爱★你★!",
"──────────────────",
"\t不需要太多的言语去修饰",
"──────────────────",
"\t我要你幸福","──────────────────",
" ","\t2017年1月10日"," ","\t---永远爱你的:学富include"," "
};
/*打印出爱心*/
for(y = 1.3;y >= -1.3; y -= U)
{
for(x = -1.2; x <= 2.7; x = V)
{
if((( (x*x y*y - 1)*(x*x y*y - 1) * (x*x y*y - 1)
-x*x*y*y*y )<= 0))
printf("*");
/*打印表白的话*/
else if(x>1.2){
printf("\t");
for(int j=0;WhatYouWantToSay[i][j]!='\0';j )
{
printf("%c",WhatYouWantToSay[i][j]);
if(i%2)
Sleep(1);
else
Sleep(rand()%90);
}
if(i==4)
printf("★%s★",GFNAME);
break;
}
else
printf(" ");
fflush(stdout);
Sleep(10);
}
printf("\n");
i ;
}
}
/*显示骷髅*/
void showSkull()
{
char filename[]="kl.txt";
FILE *fp;
if(!(fp=fopen(filename,"a ")))
printf("Can't open the file!\n");
char buf[128];
while(fgets(buf,128,fp))
{
printf("\t\t\t%s",buf);
}
printf("\n");
}
int main()
{
char name[32];
printf("\t\t\t请输入你的名字,查看神秘礼物,回车确定:\n\t\t\t");
/*获取输入的名字*/
scanf("%s",name);
system("cls");
/*如果输入的名字为女友的名字*/
if(strcmp(name,GFNAME)==0)
showLove();
else
showSkull();
return 0;
}