找回密碼
 註冊
搜索
熱搜: 活動 交友 discuz
查看: 1985|回覆: 0

[原創] 猜猜我猜猜

[複製鏈接]
發表於 2007-6-15 11:36:36 | 顯示全部樓層 |閲讀模式
  1. #include<iostream>
  2. using namespace std;
  3. int main()
  4. {
  5.     char a[5]="1234";
  6.     char b[5];
  7.    
  8.     cin>>b;
  9.     int sa=0,sb=0;
  10.     for(int i=0;i<4;i++)
  11.     {
  12.         if(a[i]==b[i])
  13.             sa=sa+1;
  14.     }      
  15.       
  16.     for(int i=0;i<4;i++)
  17.     {
  18.         for(int j=0;j<4;j++)
  19.         {
  20.                 if(i!=j&&(a[i]=b[j]))
  21.                 sb=sb+1;
  22.         }
  23.     }
  24.     if(sa==4)
  25.         cout<<"答對囉!";
  26.     else
  27.         cout<<"猜錯囉!!在加油唄!!";
  28.       
  29.     system("pause");
  30.     return 0;
  31. }
複製代碼
您需要登錄後才可以回帖 登錄 | 註冊

本版積分規則

Checking the Pageranks

Archiver|手機版|小黑屋|WEO

GMT+8, 2026-7-29 11:56 PM , Processed in 0.007922 second(s), 18 queries .

Powered by Discuz! X5.0 Licensed

© 2001-2026 Discuz! Team.

快速回復 返回頂部 返回列表