鱼C论坛

 找回密码
 立即注册
楼主: 向往青莲

[技术交流] #鱼C五周年嘉年华#《C趣味》--第一发

[复制链接]
发表于 2015-1-25 21:46:01 | 显示全部楼层
学渣表示代码貌似有点长
  1. #include<stdio.h>
  2. #include<conio.h>
  3. #include<graphics.h>

  4. typedef struct node
  5. {
  6. int smallx;
  7. int smally;
  8. int bigx;
  9. int bigy;
  10. }node;

  11. node f[20];
  12. void print(int n,int s)
  13. {

  14. setfillcolor(s);
  15. bar(f[n].bigx*20+10,f[n].bigy*20+10,f[n].bigx*20+20,(f[n].bigy+f[n].smally)*20+20);
  16. bar(f[n].bigx*20+10,f[n].bigy*20+10,(f[n].bigx+f[n].smallx)*20+20,f[n].bigy*20+20);

  17. }


  18. void main()
  19. {
  20.         int n,s;
  21. //画线条
  22. f[0].smallx=4;
  23. f[0].smally=4;
  24. f[0].bigx=0;
  25. f[0].bigy=0;

  26. f[1].smallx=4;
  27. f[1].smally=4;
  28. f[1].bigx=0;
  29. f[1].bigy=4;

  30. f[2].smallx=0;
  31. f[2].smally=8;
  32. f[2].bigx=7;
  33. f[2].bigy=0;

  34. f[3].smallx=4;
  35. f[3].smally=4;
  36. f[3].bigx=10;
  37. f[3].bigy=0;


  38. f[4].smallx=4;
  39. f[4].smally=0;
  40. f[4].bigx=10;
  41. f[4].bigy=4;

  42. f[5].smallx=0;
  43. f[5].smally=4;
  44. f[5].bigx=14;
  45. f[5].bigy=4;

  46. f[6].smallx=4;
  47. f[6].smally=0;
  48. f[6].bigx=10;
  49. f[6].bigy=8;

  50. f[7].smallx=0;
  51. f[7].smally=8;
  52. f[7].bigx=17;
  53. f[7].bigy=0;

  54. f[8].smallx=4;
  55. f[8].smally=0;
  56. f[8].bigx=17;
  57. f[8].bigy=4;

  58. f[9].smallx=0;
  59. f[9].smally=8;
  60. f[9].bigx=21;
  61. f[9].bigy=0;

  62. f[10].smallx=4;
  63. f[10].smally=8;
  64. f[10].bigx=24;
  65. f[10].bigy=0;

  66. f[11].smallx=4;
  67. f[11].smally=0;
  68. f[11].bigx=24;
  69. f[11].bigy=8;

  70. initgraph(600,400);
  71.         while(1)
  72.         {
  73.         for(s=0;s<255;s++)
  74.                 for(n=0;n<12;n++)
  75.                 {
  76.                 print(n,s);       
  77.                 }
  78.         }
  79. closegraph();

  80. }
复制代码

评分

参与人数 1鱼币 +15 收起 理由
康小泡 + 15 15分 已评

查看全部评分

想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

发表于 2015-1-25 22:28:20 | 显示全部楼层

回帖奖励 +5 鱼币

再来2个
  1. #include<stdio.h>
  2. #include<conio.h>
  3. #include<graphics.h>

  4. typedef struct node
  5. {
  6. int smallx;
  7. int smally;
  8. int bigx;
  9. int bigy;
  10. }node;

  11. node f[12];

  12. void move1(int n,int s)
  13. {

  14. setfillcolor(GREEN);
  15. bar(f[n].bigx*s+10,f[n].bigy*s+10,f[n].bigx*s+20,(f[n].bigy+f[n].smally)*s+20);
  16. bar(f[n].bigx*s+10,f[n].bigy*s+10,(f[n].bigx+f[n].smallx)*s+20,f[n].bigy*s+20);

  17. }
  18. void move2(int n,int s)
  19. {

  20. setfillcolor(BLACK);
  21. bar(f[n].bigx*s+10,f[n].bigy*s+10,f[n].bigx*s+20,(f[n].bigy+f[n].smally)*s+20);
  22. bar(f[n].bigx*s+10,f[n].bigy*s+10,(f[n].bigx+f[n].smallx)*s+20,f[n].bigy*s+20);

  23. }

  24. void main()
  25. {
  26.         int n,s;
  27. //画线条
  28. f[0].smallx=4;
  29. f[0].smally=4;
  30. f[0].bigx=0;
  31. f[0].bigy=0;

  32. f[1].smallx=4;
  33. f[1].smally=4;
  34. f[1].bigx=0;
  35. f[1].bigy=4;

  36. f[2].smallx=0;
  37. f[2].smally=8;
  38. f[2].bigx=7;
  39. f[2].bigy=0;

  40. f[3].smallx=4;
  41. f[3].smally=4;
  42. f[3].bigx=10;
  43. f[3].bigy=0;


  44. f[4].smallx=4;
  45. f[4].smally=0;
  46. f[4].bigx=10;
  47. f[4].bigy=4;

  48. f[5].smallx=0;
  49. f[5].smally=4;
  50. f[5].bigx=14;
  51. f[5].bigy=4;

  52. f[6].smallx=4;
  53. f[6].smally=0;
  54. f[6].bigx=10;
  55. f[6].bigy=8;

  56. f[7].smallx=0;
  57. f[7].smally=8;
  58. f[7].bigx=17;
  59. f[7].bigy=0;

  60. f[8].smallx=4;
  61. f[8].smally=0;
  62. f[8].bigx=17;
  63. f[8].bigy=4;

  64. f[9].smallx=0;
  65. f[9].smally=8;
  66. f[9].bigx=21;
  67. f[9].bigy=0;

  68. f[10].smallx=4;
  69. f[10].smally=8;
  70. f[10].bigx=24;
  71. f[10].bigy=0;

  72. f[11].smallx=4;
  73. f[11].smally=0;
  74. f[11].bigx=24;
  75. f[11].bigy=8;

  76. initgraph(1000,400);
  77.         while(1)
  78.         {
  79.         for(s=1;s<20;s++)
  80.         {               
  81.                         for(n=0;n<12;n++)
  82.                         {
  83.                         move1(n,s);
  84.                         }
  85.                         Sleep(100);
  86.                         for(n=0;n<12;n++)
  87.                         {
  88.                         move2(n,s);                                                                   
  89.                         }
  90.         }
  91.         }
  92. closegraph();
  93. }
复制代码

  1. #include<stdio.h>
  2. #include<conio.h>
  3. #include<graphics.h>

  4. typedef struct node
  5. {
  6. int smallx;
  7. int smally;
  8. int bigx;
  9. int bigy;
  10. }node;

  11. node f[12];

  12. void move1(int n)
  13. {

  14. setfillcolor(GREEN);
  15. bar(f[n].bigx*20+10,f[n].bigy*20+10,f[n].bigx*20+20,(f[n].bigy+f[n].smally)*20+20);
  16. bar(f[n].bigx*20+10,f[n].bigy*20+10,(f[n].bigx+f[n].smallx)*20+20,f[n].bigy*20+20);

  17. }
  18. void move2(int n)
  19. {

  20. setfillcolor(BLACK);
  21. bar(f[n].bigx*20+10,f[n].bigy*20+10,f[n].bigx*20+20,(f[n].bigy+f[n].smally)*20+20);
  22. bar(f[n].bigx*20+10,f[n].bigy*20+10,(f[n].bigx+f[n].smallx)*20+20,f[n].bigy*20+20);

  23. }

  24. void main()
  25. {
  26.         int n,s;
  27.         s=1;
  28. //画线条
  29. f[0].smallx=4;
  30. f[0].smally=4;
  31. f[0].bigx=0;
  32. f[0].bigy=0;

  33. f[1].smallx=4;
  34. f[1].smally=4;
  35. f[1].bigx=0;
  36. f[1].bigy=4;

  37. f[2].smallx=0;
  38. f[2].smally=8;
  39. f[2].bigx=7;
  40. f[2].bigy=0;

  41. f[3].smallx=4;
  42. f[3].smally=4;
  43. f[3].bigx=10;
  44. f[3].bigy=0;


  45. f[4].smallx=4;
  46. f[4].smally=0;
  47. f[4].bigx=10;
  48. f[4].bigy=4;

  49. f[5].smallx=0;
  50. f[5].smally=4;
  51. f[5].bigx=14;
  52. f[5].bigy=4;

  53. f[6].smallx=4;
  54. f[6].smally=0;
  55. f[6].bigx=10;
  56. f[6].bigy=8;

  57. f[7].smallx=0;
  58. f[7].smally=8;
  59. f[7].bigx=17;
  60. f[7].bigy=0;

  61. f[8].smallx=4;
  62. f[8].smally=0;
  63. f[8].bigx=17;
  64. f[8].bigy=4;

  65. f[9].smallx=0;
  66. f[9].smally=8;
  67. f[9].bigx=21;
  68. f[9].bigy=0;

  69. f[10].smallx=4;
  70. f[10].smally=8;
  71. f[10].bigx=24;
  72. f[10].bigy=0;

  73. f[11].smallx=4;
  74. f[11].smally=0;
  75. f[11].bigx=24;
  76. f[11].bigy=8;

  77. initgraph(1000,400);
  78.         while(1)
  79.         {
  80.                 if(f[0].bigx <0||f[11].bigx >45)s=-s;
  81.                         for(n=0;n<12;n++)
  82.                         {
  83.                         move1(n);
  84.                         }
  85.                         Sleep(100);
  86.                         for(n=0;n<12;n++)
  87.                         {
  88.                         move2(n);                       
  89.                     f[n].bigx =f[n].bigx +s;                                       
  90.         }
  91.         }
  92. closegraph();
  93. }
复制代码

评分

参与人数 1荣誉 +15 鱼币 +30 收起 理由
康小泡 + 15 + 30 45 已评

查看全部评分

想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

发表于 2015-1-26 10:03:46 | 显示全部楼层

回帖奖励 +5 鱼币

来晚了吗
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

发表于 2015-1-26 10:10:49 | 显示全部楼层
//微辣小菜
#include<stdio.h>
int main()
{
        int i;
        for(i = 0;i <= 1000;i++)
        {
                printf("Welcome to Fishc");
        }
        return 0;
}
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

发表于 2015-1-26 10:11:24 | 显示全部楼层
  1. #include<stdio.h>
  2. int main()
  3. {
  4.         int i;
  5.         for(i = 0;i <= 1000;i++)
  6.         {
  7.                 printf("Welcome to Fishc");
  8.         }
  9.         return 0;
  10. }
复制代码

评分

参与人数 1鱼币 +10 收起 理由
康小泡 + 10 10分 已评

查看全部评分

想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

发表于 2015-1-26 10:31:28 | 显示全部楼层
  1. //中辣小菜  date : 1.26
  2. #include<stdio.h>
  3. #include<windows.h>
  4. int main()
  5. {
  6.         int n = 1;
  7.         int i;
  8.         while(n < 1000)
  9.         {
  10.                 for(i = 1;i < n;i++)
  11.                 {
  12.                         printf(" ");
  13.                 }
  14.                 n++;
  15.                 printf("Welcome to Fishc");
  16.         //        Sleep(500);             //可调节间隔
  17.                 system("cls");
  18.     }
  19.         return 0;
  20. }
复制代码

评分

参与人数 1鱼币 +15 收起 理由
康小泡 + 15 15分 已评

查看全部评分

想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

发表于 2015-1-26 10:44:29 | 显示全部楼层
  1. //特辣小菜
  2. #include<stdio.h>
  3. int main()
  4. {
  5.         printf("*****          **               * * *            *                     *****\n");
  6.         printf("*                              *                  *                   *\n");
  7.         printf("*****          **              *                  *****              *\n");
  8.         printf("*              **                    *            *    *              *\n");
  9.         printf("*              **               * * *             *    *               *****\n");
  10.         return 0;
  11. }
复制代码

这样可以了吧,哈哈,都完成了

评分

参与人数 1鱼币 +20 收起 理由
康小泡 + 20 20分 已评

查看全部评分

想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

发表于 2015-1-26 10:52:35 | 显示全部楼层

回帖奖励 +5 鱼币

鱼C加油
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

发表于 2015-1-26 12:11:41 | 显示全部楼层
前来报到,支持小甲鱼
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

发表于 2015-1-26 14:41:32 | 显示全部楼层

回帖奖励 +5 鱼币

这个要先支持一下,现在不算晚吧
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

发表于 2015-1-26 14:43:04 | 显示全部楼层

回帖奖励 +5 鱼币

围观
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复

使用道具 举报

发表于 2015-1-26 18:48:05 | 显示全部楼层

回帖奖励 +5 鱼币

要动的怎么写啊,不会啊
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

发表于 2015-1-26 21:05:22 | 显示全部楼层

回帖奖励 +5 鱼币

C语言不会,不过支持各位大神
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

发表于 2015-1-27 05:43:48 | 显示全部楼层
我来学习下
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

发表于 2015-1-27 10:07:05 | 显示全部楼层
特辣小菜


  1. #include <stdio.h>
  2. #include <windows.h>

  3. //*****                                       *                  
  4. //*              **             ****          *                 ****
  5. //*****                         *             ****             *
  6. //*              **               *           *   *            *
  7. //*              **            ** *           *   *             ****
  8. //
  9. #define N 5


  10. void GoToXY(int x,int y)
  11. {
  12.         COORD pos = {x,y};
  13.         HANDLE hOut = GetStdHandle(STD_OUTPUT_HANDLE);
  14.         SetConsoleCursorPosition(hOut, pos);
  15. }

  16. char f[5][5] = {'*','*','*','*','*',
  17.                 '*',' ',' ',' ',' ',
  18.                 '*','*','*','*','*',
  19.                 '*',' ',' ',' ',' ',
  20.                 '*',' ',' ',' ',' ' };

  21.     char i[5][5] = {' ',' ',' ',' ',' ',
  22.                     '*','*',' ',' ',' ',
  23.                     ' ',' ',' ',' ',' ',
  24.                     '*','*',' ',' ',' ',
  25.                     '*','*',' ',' ',' ' };

  26.     char s[5][5] = {' ',' ',' ',' ',' ',
  27.                     ' ','*','*','*','*',
  28.                     ' ','*',' ',' ',' ',
  29.                     ' ',' ',' ','*',' ',
  30.                     '*','*',' ','*',' ' };

  31.     char h[5][5] = {'*',' ',' ',' ',' ',
  32.                     '*',' ',' ',' ',' ',
  33.                     '*','*','*','*',' ',
  34.                     '*',' ',' ',' ','*',
  35.                     '*',' ',' ',' ','*' };
  36.    


  37.     char c[5][5] = {' ',' ',' ',' ',' ',
  38.                     ' ','*','*','*','*',
  39.                     '*',' ',' ',' ',' ',
  40.                     '*',' ',' ',' ',' ',
  41.                     ' ','*','*','*','*' };

  42. void printChar(char a[N][N],int n)
  43. {
  44.     int i,j;
  45.         for ( i=0;i < N ;i++)
  46.         {
  47.             for ( j=0;j < N ;j++)
  48.             {
  49.                 GoToXY(n*10 + j, i);
  50.                 printf("%c",a[i][j]);
  51.                 Sleep(80);
  52.             }
  53.         }
  54.         
  55. }


  56. void main()
  57. {

  58.     while(1){

  59.    
  60.    printChar(f,0);

  61.    printChar(i,1);

  62.    printChar(s,2);

  63.    printChar(h,3);

  64.    printChar(c,4);

  65.     system("cls");
  66.    }
  67.    

  68.    
  69. }
复制代码

评分

参与人数 1鱼币 +25 收起 理由
康小泡 + 25 25分 已评

查看全部评分

想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

发表于 2015-1-27 11:44:39 | 显示全部楼层

回帖奖励 +5 鱼币

本帖最后由 恒少-卖身契 于 2015-1-27 11:45 编辑

微辣小菜
  1. #include <stdio.h>

  2. int main()
  3. {
  4.     int i, j;
  5.     for(i = 0; i < 50; i++)
  6.     {
  7.         for(j = 0; j < 3; j++)
  8.             printf("Welcom to FishC!\t");
  9.         printf("\n");
  10.     }

  11.     return 0;
  12. }
复制代码


中辣小菜
  1. #include <stdio.h>
  2. #include <windows.h>

  3. int main()
  4. {
  5.     int i, j, n;

  6.     for(n = 0; n < 100; n++)
  7.     {
  8.         for(i = 0; i < 20; i++)
  9.         {
  10.             for(j = 0; j < 3; j++)
  11.             {
  12.                 printf("welcom to FishC!\t");
  13.                 Sleep(10);
  14.             }
  15.             printf("\n");
  16.             Sleep(10);
  17.         }
  18.         Sleep(10);
  19.         system("cls");
  20.     }

  21.     return 0;
  22. }
复制代码


热辣小菜
  1. #include <stdio.h>

  2. int main()
  3. {
  4.     printf("**********   ********   ************   **        **      **********\n");
  5.     printf("**********   ********   ************   **        **     ***********\n");
  6.     printf("**              **      **             **        **    **          \n");
  7.     printf("**              **      **             **        **   **           \n");
  8.     printf("**              **      **             **        **   **           \n");
  9.     printf("**              **      **             **        **   **           \n");
  10.     printf("*******         **      ************   ************   **           \n");
  11.     printf("*******         **      ************   ************   **           \n");
  12.     printf("**              **                **   **        **   **           \n");
  13.     printf("**              **                **   **        **   **           \n");
  14.     printf("**              **                **   **        **   **           \n");
  15.     printf("**              **                **   **        **    **          \n");
  16.     printf("**           ********   ************   **        **     ***********\n");
  17.     printf("**           ********   ************   **        **      **********\n");
  18.     return 0;
  19. }
复制代码

评分

参与人数 1荣誉 +15 鱼币 +30 收起 理由
康小泡 + 15 + 30 45 已评

查看全部评分

想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

发表于 2015-1-27 17:03:27 | 显示全部楼层

回帖奖励 +5 鱼币

到哪天结束啊
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

发表于 2015-1-27 17:58:45 | 显示全部楼层

回帖奖励 +5 鱼币

我要努力,支持大神!
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

发表于 2015-1-27 20:44:12 | 显示全部楼层
还有。。。?
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复

使用道具 举报

发表于 2015-1-27 22:10:32 | 显示全部楼层

回帖奖励 +5 鱼币

老白,来学习大神们的思路{:1_1:}
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Archiver|鱼C工作室 ( 粤ICP备18085999号-1 | 粤公网安备 44051102000585号)

GMT+8, 2024-5-10 17:19

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表