元旦

作者: 实在想不出昵称丶 | 来源:发表于2017-01-01 20:33 被阅读0次

还行吧,毕竟没怎么学好c。

还行吧

#include<stdio.h>
#include<stdlib.h>
#include<windows.h>
void arrprint();
void arrprint_run();
void move(int x,int y);
void gotoxy(int x,int y);
int wherex() ;
int wherey() ;
void moveRight(int x);
void moveLeft(int x);
void moveUp(int x);
void moveDown(int x);
int main(){
    system("color 2a");
     
    moveRight(4);
    moveUp(4);
     
     int m=wherex();
     int n=wherey();
    system("cls"); 
    system("color 2f");
     char str[]="新年快乐,元旦快乐。";
     char str2[]="2017年到了,再不管去年那些破事儿了。";
     for(int i=0;i<80;i++){
        gotoxy(m,n);
        moveRight(1);
        gotoxy(m+8,n);
        puts(str);
        if(i>4){
             gotoxy(m+8,n+4);
             puts(str2);
          }
         
      }
    
    return 0;
} 
int wherex()  //获取光标x 
{  
    CONSOLE_SCREEN_BUFFER_INFO pBuffer;  
    GetConsoleScreenBufferInfo(GetStdHandle(STD_OUTPUT_HANDLE), &pBuffer);  
    return (pBuffer.dwCursorPosition.X+1);  
}  
//获取光标的位置y  
int wherey()  //获取光标y 
{  
    CONSOLE_SCREEN_BUFFER_INFO pBuffer;  
    GetConsoleScreenBufferInfo(GetStdHandle(STD_OUTPUT_HANDLE), &pBuffer);  
    return (pBuffer.dwCursorPosition.Y+1);  
}  
void gotoxy(int x,int y)   //设置光标 
{  
    COORD c;  
    c.X=x-1;  
    c.Y=y-1;  
    SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE),c);  
} 
void moveRight(int x){
        int m=wherex();
        int n=wherey();
    for(int i=0;i<x;i++){
        move(m+i*2,n);
        system("cls");
    }
        gotoxy(m+(x-1)*2,n);
}
void moveLeft(int x){
        int m=wherex();
        int n=wherey();
    for(int i=0;i<x;i++){
        move(m-i*2,n);
        system("cls");
    }
        gotoxy(m-(x-1)*2,n);
}
void moveUp(int x){
        int m=wherex();
        int n=wherey();
    for(int i=0;i<x;i++){
        move(m,n+i*2);
        system("cls");
    }
        gotoxy(m,n+(x-1)*2);
}
void moveDown(int x){
        int m=wherex();
        int n=wherey();
    for(int i=0;i<x;i++){
        move(m,n-i*2);
        system("cls");
    }
        gotoxy(m,n-(x-1)*2);
}
void move(int x,int y){
        
        
        gotoxy(x,y);
        arrprint();
        Sleep(150); 
        gotoxy(x,y);
        arrprint_run();
        Sleep(150);
        gotoxy(x,y);
        arrprint(); 
        Sleep(150);
}
void arrprint(){
    char str[5][5]={{' ',' ','o',' ',' '},{'o','o','o','o','o'},{' ',' ','o',' ',' '},{' ','o',' ','o',' '},{'o',' ',' ',' ','o'}};
    for(int i=0;i<5;i++){
        
        for(int j=0;j<5;j++)
          printf("%c",str[i][j]);
       gotoxy(wherex()-5,wherey()+1);
       //printf("\n");
    }   
}
void arrprint_run(){
    char str[5][5]={{' ',' ','o',' ',' '},{'o','o','o','o','o'},{' ',' ','o',' ',' '},{' ',' ','o',' ',' '},{' ',' ','o',' ',' '}};
    for(int i=0;i<5;i++){
        
        for(int j=0;j<5;j++)
          printf("%c",str[i][j]);
        gotoxy(wherex()-5,wherey()+1);
        // printf("\n");
    }   
}



相关文章

  • 元旦,元旦

    今天是新年的第一天。侄儿大婚。 家中许久都没有喜庆的事了。元旦伊始,大家仿佛把一年的喜事都聚焦在了一起。不论男女老...

  • 元旦喽,元旦喽,元旦喽

    2022,你来了,你终于来啦! 时间就是这样,它不以人的意志为转移。其实说心里话,2022,是我们每个人都期盼的,...

  • 元旦时节话“元旦”

    每年1月1日,伴着新年的钟声,标志着新的一年的到来。今天又逢元旦,2018年已渐行渐远,2019年模式正式开...

  • 元旦,谁的元旦

    年去年来又一年,朝廷又说胜前年。 囊中年年更差涩,官家岁岁多收钱。 闻讯美帝又减税,羡煞屁民泪涟涟。 中产能高思移...

  • 元旦快乐!【元旦福利】

    元旦番外哦! 元旦快乐啊!我们一起跨年啦 新年礼物:笑一个。 期待全新的一年,好像可以给自己一个理由,扔掉一切糟糕...

  • 元旦之际话“元旦”

    现在人们把公历的1月1日称之为“元旦”,这似乎是理所应当的事情。然而,这里面有两个问题。 第一个问题:为什么新年的...

  • 随笔‖元旦说“元旦”

    今天是元旦。新的一天,早安!新的一年,万事顺心! 元,谓“始”,凡数之始称为“元”;旦,谓“日出”,太阳出地平线;...

  • 中国典籍里的元旦 中国古代有元旦吗?中国古代的元旦和现代的元旦是

    元旦是什么时候? 现代的元旦是什么时候? 古代的元旦是什么时候? 中国古代有元旦吗? 中国古代的元旦和现代的元旦是...

  • 元旦

    元旦 与平日无异 起床 带起琐碎的平淡 冬日清艳 期盼心如天色 庸碌一日 抬头见日已西落 低头细看 影渐薄淡与天色...

  • 元旦

    今天是1月1号 每年的今天都会有很多的节目比如我们上个眼的,我们就表演了很多节目,我们本来要出一套节目的,可是,唉...

网友评论

      本文标题:元旦

      本文链接:https://www.haomeiwen.com/subject/yqmivttx.html