新年快乐(用软件去祝你的好朋友新年快乐,有亿点简陋)C语言
作者:互联网
这里就用软件的方式去祝你好朋友新年快乐。大概的图片就是下面的
下面就是弹球环节
再往下就是操控飞机的小游戏环节
最后的话想改就可以改
(不好意思没有加注释)
下面就是代码:
#include <stdio.h>
#include <windows.h>
#include <string.h>
#include <conio.h>
void show1()
{
printf("---------------------------------------------------\n");
printf("|"); printf(" 新年快乐 "); printf("|\n");
printf("|"); printf(" 我就不送一个现实的礼物 "); printf("|\n");
printf("|"); printf(" 现在送一个虚拟的小礼物 "); printf("|\n");
printf("|"); printf(" "); printf("|\n");
printf("|"); printf(" iiiiiiiiiii "); printf("|\n");
printf("|"); printf(" |:H:a:p:p:y:| "); printf("|\n");
printf("|"); printf(" __|___________|__ "); printf("|\n");
printf("|"); printf(" |^^^^^^^^^^^^^^^^^| "); printf("|\n");
printf("|"); printf(" ------------------- "); printf("|\n");
printf("|"); printf(" "); printf("|\n");
printf("---------------------------------------------------\n");
system("pause") ;
printf ("接下来就是小弹球弹弹弹,请耐心等待弹完然后就。。。\n");
printf("___________________________________________________________________________\n");
system("pause") ;
}
void show2()
{
int max = 20,max_=20,re =1,sheji=1;
int i,j,k,l;
char cin1;
int ran= rand() % 30;
while (1)
{
system("cls");
if (re == 1) {
printf("w向前飞,s向后飞,a向左飞,d向右飞,j发射光线。\n");
if (sheji == 1)
{
printf("快击败困难\n");
for (k = 0; k <= ran; k++)
printf(" ");
printf("------\n");
for (k = 0; k <= ran; k++)
printf(" ");
printf("|困难|\n");
for (k = 0; k <= ran; k++)
printf(" ");
printf("------\n");
}
else if (sheji == 2)
{
printf("快击败伤心\n");
for (k = 0; k <= ran; k++)
printf(" ");
printf("------\n");
for (k = 0; k <= ran; k++)
printf(" ");
printf("|伤心|\n");
for (k = 0; k <= ran; k++)
printf(" ");
printf("------\n");
}
else if (sheji == 3)
{
printf("击破开心就一直开心了\n");
for (k = 0; k <= ran; k++)
printf(" ");
printf("------\n");
for (k = 0; k <= ran; k++)
printf(" ");
printf("|开心|\n");
for (k = 0; k <= ran; k++)
printf(" ");
printf("------\n");
}
else if (sheji == 4)
{
printf("\n");
printf("\n");
printf("\n");
printf("哈哈哈战胜了困难和伤心,得到了快乐未来更加美好!!!");
system("pause");
break;
}
for (i = 0; i < max; i++)
printf("\n");
for (j = 0; j < max_; j++)
printf(" ");
printf(" o\n");
for (j = 0; j < max_; j++)
printf(" ");
printf("|+^+|\n");
for (j = 0; j < max_; j++)
printf(" ");
printf(" | |");
cin1 = _getch();
if (cin1 == 'w')
{
max--;
}
else if (cin1 == 's')
{
max++;
}
else if (cin1 == 'a')
{
max_--;
}
else if (cin1 == 'd')
{
max_++;
}
else if (cin1 == 'j')
{
re = 2;
}
else continue;
}
else if (re == 2)
{
printf("没想到飞机会改变吧哈哈哈哈\n");
if (sheji==1)
{
printf("快击败困难\n");
for (k = 0; k <= ran; k++)
printf(" ");
printf("------\n");
for (k = 0; k <= ran; k++)
printf(" ");
printf("|困难|\n");
for (k = 0; k <= ran; k++)
printf(" ");
printf("------\n");
}
else if (sheji == 2)
{
printf("快击败伤心\n");
for (k = 0; k <= ran; k++)
printf(" ");
printf("------\n");
for (k = 0; k <= ran; k++)
printf(" ");
printf("|伤心|\n");
for (k = 0; k <= ran; k++)
printf(" ");
printf("------\n");
}
else if (sheji == 3)
{
printf("击破开心就一直开心了\n");
for (k = 0; k <= ran; k++)
printf(" ");
printf("------\n");
for (k = 0; k <= ran; k++)
printf(" ");
printf("|开心|\n");
for (k = 0; k <= ran; k++)
printf(" ");
printf("------\n");
}
else if (sheji == 4)
{
printf("\n");
printf("\n");
printf("\n");
Sleep(2 * 1000);
printf("哈哈哈战胜了困难和伤心,得到了快乐未来更加美好!!!\n");
system("pause");
break;
}
for (i = 0; i < max; i++)
{
for (j = 0; j < max_+2; j++)
printf(" ");
printf("|\n");
}
for (j = 0; j < max_; j++)
printf(" ");
printf(" ^\n");
for (j = 0; j < max_; j++)
printf(" ");
printf("(qop)\n");
for (j = 0; j < max_; j++)
printf(" ");
printf(" [0]\n");
cin1 = _getch();
if (cin1 == 'w')
{
max--;
}
else if (cin1 == 's')
{
max++;
}
else if (cin1 == 'a')
{
max_--;
}
else if (cin1 == 'd')
{
max_++;
}
else continue;
if (ran + 3 >= max_ && max_ >= ran - 1)
{
sheji++;
ran = rand() % 30;
}
re=1;
}
}
}
void show3()
{
int x_max = 49,y_max=20;
int i, j, k,l,m,k1,k2,k3;
k = -1; k1 = 1;
k2 = -1; k3 = 1;
m = 0;
for (l = 0; l <= 600; l++)
{
if (x_max == 49 || y_max == 20 || x_max == 0 || y_max == 0)
m=m+k1;
if (y_max <= 20)
y_max -= k1;
if (y_max == 0 || y_max >= 20)
k1 = k1 * k;
if (x_max <= 49)
x_max -= k3;
if (x_max == 0 || x_max >= 49)
k3 = k2 * k3;
for (i = 0; i < y_max; i++)
printf("\n");
for (j = 0; j < x_max; j++)
printf(" ");
printf("●");
system("cls");
}
}
void show4()
{
printf("因为时间不太够所以就只能做成这样,下次一定做的比这个好。\n");
printf("还有那个\n");
printf("新年快乐!!!\n");
printf("给你点首歌\"让风告诉你\"\n");
printf("想什么呢?\n");
printf("这里就放不出来,去酷狗吧\n");
system("pause") ;
}
int main()
{
show1();
show3();
show2();
show4();
}
祝大家新年快乐!!!
标签:新年快乐,20,亿点,int,max,system,C语言,printf 来源: https://blog.csdn.net/Hui_Zane/article/details/122263294