身为程序员的你,想没想过你的技术能够在求爱的时候用上呢?如果能用写程序的方式表白,这又何尝不是一种浪漫呢?!

       这不,已经有程序员同行写出了这样的程序,如果你也是个程序员,可以从中得到启发,做出自己专属的表白程序,如果不是,也可以直接拿此程序炫耀下。

       此程序是用C++语言所写。下面我们就来欣赏下程序代码及运行结果。

       代码如下:

C++代码
  1. #include <iostream>
    #include <windows.h>
    #include <stdio.h>
    using namespace std;
  2.   
  3. #define stoptimeshort  40   
  4. #define stoptimelong   100 
  5.   
  6. void main()   
  7. {   
  8.     //////////////////   
  9.     char ch[10];   
  10.     int f[9][36]={  0,1,1,1,1,1,0,0,0,0,0,0,1,1,0,0,0,0,0,1,1,0,0,0,0,0,1,0,0,0,0,0,0,0,0,1,   
  11.                     0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,1,0,1,0,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,1,   
  12.                     0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,0,1,   
  13.                     0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,0,1,   
  14.                     0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,1,   
  15.                     0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,0,0,0,1,   
  16.                     0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,1,   
  17.                     0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,1,0,   
  18.                     0,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0   
  19.                  };   
  20.     int s[9][21]={  0,0,0,1,1,0,0,0,0,0,1,1,0,0,0,0,1,1,0,0,0,   
  21.                     0,1,0,0,0,0,1,0,1,0,0,0,0,1,0,0,0,0,0,1,0,   
  22.                     1,0,0,0,0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,1,   
  23.                     1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,1,   
  24.                     0,1,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,1,0,   
  25.                     0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,1,0,0,   
  26.                     0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,   
  27.                     0,0,0,0,0,0,1,0,1,0,0,0,1,0,1,0,0,0,0,0,0,   
  28.                     0,0,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,0,0,   
  29.                  };   
  30.     int t[9][22]={  0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,   
  31.                     0,1,0,0,0,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,1,0,   
  32.                     1,0,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,0,0,1,   
  33.                     1,0,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,   
  34.                     0,1,0,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,0,0,1,0,   
  35.                     0,0,1,0,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,1,0,0,   
  36.                     0,0,0,0,1,0,0,0,0,1,0,0,0,0,1,0,0,1,0,0,0,0,   
  37.                     0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,1,1,0,0,0,0,0,   
  38.                     0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,   
  39.                  };   
  40.     system ( "title I Love You" );   
  41.     //////////////////   
  42.     printf ( "%s","        " );   
  43.     Sleep ( stoptimelong );   
  44.     printf ( "%s","其" );   
  45.     Sleep ( stoptimeshort );   
  46.     printf ( "%s","实\n" );   
  47.     ////////////////////////////////   
  48.     printf ( "%s","        " );   
  49.     system ( "color 72" );   
  50.     Sleep ( stoptimelong );   
  51.     printf ( "%s","有" );   
  52.     Sleep ( stoptimeshort );   
  53.     printf ( "%s","一" );   
  54.     Sleep ( stoptimeshort );   
  55.     printf ( "%s","句" );   
  56.     Sleep ( stoptimeshort );   
  57.     printf ( "%s","话\n" );   
  58.     ///////////////////////////   
  59.     printf ( "%s","        " );   
  60.     system ( "color 79" );   
  61.     Sleep ( stoptimelong );   
  62.     printf ( "%s","一" );   
  63.     Sleep ( stoptimeshort );   
  64.     printf ( "%s","直" );   
  65.     Sleep ( stoptimeshort );   
  66.     printf ( "%s","藏" );   
  67.     Sleep ( stoptimeshort );   
  68.     printf ( "%s","在" );   
  69.     Sleep ( stoptimeshort );   
  70.     printf ( "%s","我" );   
  71.     Sleep ( stoptimeshort );   
  72.     printf ( "%s","心" );   
  73.     Sleep ( stoptimeshort );   
  74.     printf ( "%s","里\n" );   
  75.     /////////////////////////////   
  76.     printf ( "%s","        " );   
  77.     system ( "color 7c" );   
  78.     Sleep ( stoptimelong );   
  79.     printf ( "%s","可" );   
  80.     Sleep ( stoptimeshort );   
  81.     printf ( "%s","是\n" );   
  82.     ///////////////////////////////   
  83.     printf ( "%s","        " );   
  84.     system ( "color 7d" );   
  85.     Sleep ( stoptimelong );   
  86.     printf ( "%s","我" );   
  87.     Sleep ( stoptimeshort );   
  88.     printf ( "%s","没" );   
  89.     Sleep ( stoptimeshort );   
  90.     printf ( "%s","有" );   
  91.     Sleep ( stoptimeshort );   
  92.     printf ( "%s","勇" );   
  93.     Sleep ( stoptimeshort );   
  94.     printf ( "%s","气" );   
  95.     Sleep ( stoptimeshort );   
  96.     printf ( "%s","对" );   
  97.     Sleep ( stoptimeshort );   
  98.     printf ( "%s","你" );   
  99.     Sleep ( stoptimeshort );   
  100.     printf ( "%s","说\n" );   
  101.     ///////////////////////////////   
  102.     printf ( "%s","        " );   
  103.     system ( "color 7e" );   
  104.     Sleep ( stoptimelong );   
  105.     printf ( "%s","今" );   
  106.     Sleep ( stoptimeshort );   
  107.     printf ( "%s","天\n" );   
  108.     //////////////////////////////   
  109.     printf ( "%s","        " );   
  110.     system ( "color 7a" );   
  111.     Sleep ( stoptimelong );   
  112.     printf ( "%s","我" );   
  113.     Sleep ( stoptimeshort );   
  114.     printf ( "%s","终" );   
  115.     Sleep ( stoptimeshort );   
  116.     printf ( "%s","于" );   
  117.     Sleep ( stoptimeshort );   
  118.     printf ( "%s","鼓" );   
  119.     Sleep ( stoptimeshort );   
  120.     printf ( "%s","起" );   
  121.     Sleep ( stoptimeshort );   
  122.     printf ( "%s","勇" );   
  123.     Sleep ( stoptimeshort );   
  124.     printf ( "%s","气\n" );   
  125.     ///////////////////////////////   
  126.     printf ( "%s","        " );   
  127.     system ( "color 7b" );   
  128.     Sleep ( stoptimelong );   
  129.     printf ( "%s","我" );   
  130.     Sleep ( stoptimeshort );   
  131.     printf ( "%s","要" );   
  132.     Sleep ( stoptimeshort );   
  133.     printf ( "%s","对" );   
  134.     Sleep ( stoptimeshort );   
  135.     printf ( "%s","你" );   
  136.     Sleep ( stoptimeshort );   
  137.     printf ( "%s","说:\n" );   
  138.     ///////////////////////////////   
  139.     printf ( "%s","        " );   
  140.     system ( "color 79" );   
  141.     Sleep ( stoptimelong );   
  142.     printf ( "%s","我" );   
  143.     Sleep ( stoptimeshort );   
  144.     printf ( "%s","…\n" );   
  145.     /////////////////////////////////   
  146.     printf ( "%s","        " );   
  147.     system ( "color 72" );   
  148.     Sleep ( stoptimelong );   
  149.     printf ( "%s","我" );   
  150.     Sleep ( stoptimeshort );   
  151.     printf ( "%s","…" );   
  152.     Sleep ( stoptimeshort );   
  153.     printf ( "%s","…\n" );   
  154.     //////////////////////////////////   
  155.     Sleep ( stoptimelong );   
  156.     system ( "color fc" );   
  157.     for ( int i=0; i<9; i++ )   
  158.     {   
  159.         cout<<"        ";   
  160.         for ( int j=0; j<36; j++ )   
  161.         {   
  162.             if ( f[i][j]==0 )   
  163.                 cout<<" ";   
  164.             else  
  165.                 cout<<"*";   
  166.         }   
  167.         cout<<endl;   
  168.         Sleep ( 100 );   
  169.     }   
  170.     /////////////////////////////////////   
  171. line:   
  172.     printf ( "%s","        " );   
  173.     Sleep ( stoptimelong );   
  174.     printf ( "%s","你" );   
  175.     Sleep ( stoptimeshort );   
  176.     printf ( "%s","愿" );   
  177.     Sleep ( stoptimeshort );   
  178.     printf ( "%s","意" );   
  179.     Sleep ( stoptimeshort );   
  180.     printf ( "%s","接" );   
  181.     Sleep ( stoptimeshort );   
  182.     printf ( "%s","受" );   
  183.     Sleep ( stoptimeshort );   
  184.     printf ( "%s","我" );   
  185.     Sleep ( stoptimeshort );   
  186.     printf ( "%s","吗" );   
  187.     Sleep ( stoptimeshort );   
  188.     printf ( "%s","?(Y/N)" );   
  189.     ////////////////////////////////////   
  190.     cout<<endl;   
  191.     cout<<"        ";   
  192.     cin>>ch;   
  193.     Sleep ( stoptimelong );   
  194.     if ( ch[0]=='y'||ch[0]=='Y' )   
  195.     {   
  196.         system ( "color fc" );   
  197.         for ( int i=0; i<9; i++ )   
  198.         {   
  199.             cout<<"        ";   
  200.             for ( int j=0; j<21; j++ )   
  201.             {   
  202.                 if ( s[i][j]==0 )   
  203.                     cout<<" ";   
  204.                 else  
  205.                     cout<<"*";   
  206.             }   
  207.             cout<<endl;   
  208.             Sleep ( 100 );   
  209.         }   
  210.         Sleep ( 3000 );   
  211.     }   
  212.     else  
  213.     {   
  214.         if ( ch[0]=='n'||ch[0]=='N' )   
  215.         {   
  216.             system ( "color 0f" );   
  217.             for ( int i=0; i<9; i++ )   
  218.             {   
  219.                 cout<<"        ";   
  220.                 for ( int j=0; j<22; j++ )   
  221.                 {   
  222.                     if ( t[i][j]==0 )   
  223.                         cout<<" ";   
  224.                     else  
  225.                         cout<<"*";   
  226.                 }   
  227.                 cout<<endl;   
  228.                 Sleep ( 100 );   
  229.             }   
  230.             printf ( "%s","        " );   
  231.             Sleep ( stoptimelong );   
  232.             printf ( "%s","心" );   
  233.             Sleep ( stoptimeshort );   
  234.             printf ( "%s","碎" );   
  235.             Sleep ( stoptimeshort );   
  236.             printf ( "%s","了" );   
  237.             Sleep ( stoptimeshort );   
  238.             printf ( "%s","……\n" );   
  239.         }   
  240.         else  
  241.             goto line;   
  242.     }   
  243.     system ( "color 0f" );   
  244.     system ( "pause" );   
  245. }  

       运行效果截图:

程序员,你想过用程序表白吗?

       怎么样?还是很有意思的吧?这才是与众不同的表白方式啊!应该会增加成功几率哦!

除非特别注明,鸡啄米文章均为原创
转载请标明本文地址:http://www.jizhuomi.com/leisure/277.html
2012年12月15日
作者:鸡啄米 分类:娱乐休闲 浏览: 评论:16