新年 元旦祝福 程序

#include<stdio.h>
#include <stdlib.h>
#include <time.h>
#include <math.h>
#include<Windows.h>
#define X 25
#define I 20
#define R 340
int background[20][2 * X] = { 0 };
int SNOW = 30;


void tree()
{
int i, j, x, y;
for (i = 0; i < 3; i++)
{
y = i;
for (j = 0; j < 2 * i + 1; j++)
{
background[y][(X - i) + j] = 1;
}
}
for (i = 0; i < 5; i++)
{
y++;
for (j = 0; j < 2 * (i + 1) + 1; j++)
{
background[y][(X - (i + 1)) + j] = 1;
}
}
for (i = 0; i < 7; i++)
{
y++;
for (j = 0; j < 2 * (i + 3) + 1; j++)
{
background[y][(X - (i + 3)) + j] = 1;
}
}
for (i = 0; i < 5; i++)
{
y++;
for (j = 0; j < 3; j++)
{
background[y][X + (2 * j - 2)] = 2;
}
}
}


void snow()
{
int i;
srand(time(NULL));
for (i = 0; i < SNOW; i++)
{
int x, y;
x = rand() % (2 * X);
y = rand() % 20;
if ((background[y][x] == 0))
{
background[y][x] = 3;
}
}
}


void color(short x)
{
    if(x>=0 && x<=15)
        SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), x);
    else
        SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 7);
}






void display()
{
int x, y;
long time;
for (y = 0; y < 20; y++)
{
for (x = 0; x < 2 * X; x++)
{
if (background[y][x] == 0)
{
printf(" ");
}
if (background[y][x] == 1)
{
    color(10);


printf("*");
}






if (background[y][x] == 2)
{
  color(14);
printf("*");
}
if (background[y][x] == 3)
{
      color(15);
printf("*");
}
}
printf("\n");




}






}


void clear_snow()
{
int i, j;
for (i = 0; i < 20; i++)
{
for (j = 0; j < 2 * X; j++)
{
if (background[i][j] == 3)
{
background[i][j] = 0;
}
}
}
}


void main()
{


system("title 元旦快乐 **同学");
int n=15,m;
int i , j,l ;
tree();


system("color 3F");
printf("****全程没有 Background 为观看顺利 请自行脑补 happy new year ****\n");
Sleep(2000);
system("color 1F");
printf("尬\n");Sleep(2000);system("color 2C");printf("尬\n");Sleep(2000);system("color 4F");printf("尬\n");Sleep(2000);
  system("cls");
printf("(⊙o⊙)… 请随便输入一个大于5的数字  就好好欣赏这个小程序吧 哈哈哈 这是个倒计时工具:");
scanf("%d",&m);
system("color 3C");
while(m>=0)
{
    system("cls");
    for(i=0;i<20;i++)
    {
        for(j=0;j<20;j++)
        {
            if(i==j||i+j==20)
                printf("%d",m);
            else
                printf(" ");
        }
        printf("\n");
    }
    Sleep(1000);
    m--;
    }
     system("cls");




while (n>=0)
{


snow();
display();
Sleep(500);
n-- ;


system("cls");
clear_snow();


}
system("cls");
system("color 4F");


for(i=0;i<8;i++)
{
   for(l=0;l<i;l++)
   {
       printf("  ");
   }


   for(j=0;j<1;j++)
   {
         printf("happy new year!!\n");
   }
   printf(" \n");
   Sleep(1000);
}
     getchar();
for(i=0;i<4;i++)
{
    for(j=0;j<1;j++)
        printf(" \n");
}


printf("感谢2017 与你相遇\n");  printf(" \n");  printf(" \n");Sleep(2000);
printf("  愿2018的你能更加成熟和自信,更加欢喜和幸福\n");  printf(" \n");  printf(" \n");Sleep(2000);
printf("       愿2018 你我更好!!!\n");Sleep(2000);


system("cls");


int e;
int a;
long time;


for(i=1,a=I;i<I/2;i++,a--)
{
for(j=(int) ( I-sqrt(I*I-(a-i)*(a-i)) );j>0;j--)
printf(" ");
for(e=1;e<=2*sqrt(I*I-(a-i)*(a-i));e++)
printf("\3");
for(j=(int)
( 2*( I-sqrt(I*I-(a-i)*(a-i)) ) );j>0;j--)
printf(" ");
for(e=1;e<=2*sqrt(I*I-(a-i)*(a-i));e++)
printf("\3");
printf("\n"); }
for(i=1;i<80;i++)
{
if(i==25)
{
printf("  2018  努力  奋斗  坚持 加油 ");
i+=30;
}
printf("\3");
}
printf("\n");
for(i=1;i<=R/2;i++)
{
if(i%2||i%3)
continue;
for(j=(int) ( R-sqrt(R*R-i*i) );j>0;j--)
printf(" ");
for(e=1;e<=2*( sqrt(R*R-i*i) - (R-2*I) );e++)
printf("\3");
printf("\n");
}


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");
for(time=0;time<99999999;time++); system("color ab");
for(time=0;time<99999999;time++); system("color ac");
for(time=0;time<99999999;time++); system("color ad");
for(time=0;time<99999999;time++); system("color ae");
for(time=0;time<99999999;time++); system("color af");
for(time=0;time<99999999;time++); }
return 0;




}
发布了19 篇原创文章 · 获赞 8 · 访问量 4151

猜你喜欢

转载自blog.csdn.net/paohui001lqp/article/details/78943956