乡下人产国偷v产偷v自拍,国产午夜片在线观看,婷婷成人亚洲综合国产麻豆,久久综合给合久久狠狠狠9

  • <output id="e9wm2"></output>
    <s id="e9wm2"><nobr id="e9wm2"><ins id="e9wm2"></ins></nobr></s>

    • 分享

      猜四位數(shù)字游戲的源代碼

       孔虎飛 2008-03-07
      #include<stdio.h>
      #include<process.h>
      #include<stdlib.h>
      #include<time.h>
      #include <iostream.h>
      void help();
      void main()
      {  help();
       int p=0;
          int  a[4];
        char key;
        int k=0;
        int i=0,j,count,x,y=0;
        bool v1,v2,v3,v4,v5;
         int t,l,m,n,o;
       srand( (unsigned)time( NULL ) );        
                 //cout<<rand()%10000<<endl;              
            t=rand()%10000;
          l=t/1000;
         m=(t%1000)/100;
         n=(t%100)/10;
         o=t%10;
        int b[4];
        b[0]=l;
        b[1]=m;
        b[2]=n;
        b[3]=o;
         cout<<"如果想知道答案,請(qǐng)按#,否則按其他鍵"<<endl;
       cin>>key;
       //cout<<"正確答案是:"<<endl;
       if(key==‘#‘){
         //if(k=0;k<4;k++)
         //cout<<b[k];
         cout<<t<<endl;
            }
           
      loop:for(p=10;p>=0;p--)
        {  
       
        //cout<<b;
          k=0; 
             i=0,j=0,count=0,x=0;
         v1=false;
         v2=false;
         v3=false;
         v4=false;
         v5=true;   
       //char a[4]={0};
        cout<<"請(qǐng)輸入不同的數(shù)字:"<<endl;
        for(i=0;i<4;i++)
        cin>>a[i];  
       if(a[0]==b[0])
       {
        v1=true;
         k++;}
       if(a[1]==b[1])
       {
         v2=true;
          k++;}
       if(a[2]==b[2])
       {  k++;
             v3=true;
       }
       if(a[3]==b[3])
       { v4=true;
       k++;}
         for(i=0;i<4;i++)
         for(j=0;j<4;j++)
          if(a[i]==b[j]){
           count++;
         }
         cout<<"你猜對(duì)的數(shù)字位置的個(gè)數(shù)和猜對(duì)數(shù)字的個(gè)數(shù)"<<endl
          <<"A"<<k<<"B"<<count<<endl;
         if(v1&&v2&&v3&&v4){
         cout<<"You are clear!!"<<endl;
         break;}
         cout<<"同志還得加油哦!"<<endl;
       cout<<"如果想知道答案,請(qǐng)按#,否則按其他鍵"<<endl;
       cin>>key;
       //cout<<"正確答案是:"<<endl;
       if(key==‘#‘){
         //if(k=0;k<4;k++)
         //cout<<b[k];
         cout<<t<<endl;
            cout<<"*********Game is over***********"<<endl;
       break;}
         else goto loop;
         if(k>=10)
          cout<<"You must work hard!!"<<endl;
      }
       
      }
      void help()
      {  cout<<"************Game is begining**************"<<endl;
         cout<<"You have ten times to guess,then you want to know the key,you can enter‘#‘"<<endl;

      }

        本站是提供個(gè)人知識(shí)管理的網(wǎng)絡(luò)存儲(chǔ)空間,所有內(nèi)容均由用戶發(fā)布,不代表本站觀點(diǎn)。請(qǐng)注意甄別內(nèi)容中的聯(lián)系方式、誘導(dǎo)購買等信息,謹(jǐn)防詐騙。如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請(qǐng)點(diǎn)擊一鍵舉報(bào)。
        轉(zhuǎn)藏 分享 獻(xiàn)花(0

        0條評(píng)論

        發(fā)表

        請(qǐng)遵守用戶 評(píng)論公約