March 30, 2013

c++ memory matching game 記憶配對數字遊戲


(No: 0, 1, 2, 3, 4) (26 points) Write a program of the memory matching game.
(8 points) Read n and generate an n by n board randomly filled with the pairs of numbers from 1 to the n2/2. If n is odd, 0 is filled.
(6 points) The player can select two numbers each time.
(8 points) If two numbers match, they are left exposed. Otherwise, they return hiding.
(4 points) The game continues until all numbers are exposed and shows the times of wrong guesses.
A possible run may look like:
Enter the number: 4
*  *  *  *
*  *  *  *
*  *  *  *
*  *  *  *
Select numbers: 2 2 3 3
*  *  *  *
*  6  *  *
*  *  1  *
*  *  *  *
-------------------------
*  *  *  *
*  *  *  *


ratey12 at 無名小站 at 09:48 PM post | Reply(0) | Trackback(0) | prosecute
June 11, 2011

愛神放的煙火



操場 是愛神為了我們的真愛 所隱身變成   (我們的愛神)

天空上煙火綻放 他又在施法了 誰也逃不掉 他用心安排為妳計畫的未來 
 
他的魔力   讓我們 牽手  分手 

幸福開始 幸福結束 

愛神使你愛戀  煙火在你面前
 綻放 給你挑戰愛情的機會 

愛神使你失戀  
煙火在你背後 綻放 給你遇見真愛的機會

如果你誤會愛神 

一直埋怨他為什麼要把 他的心從你身上拿走 

你將永遠得不到真愛


ratey12 at 無名小站 at 11:26 PM post | Reply(2) | Trackback(0) | prosecute
March 31, 2011

class 日期相差


/*許巧慧---B09902147---資工一丙*
 *--------日期算天數-----------* 
元素: 
年year,月month,日day
星期 week
方法:
int sum; -->回傳相差的天數      
setData(int,int,int);   --> 設定日期一 
setData2(int,int,int);  --> 設定日期二    
setyear(int);  --> 設定時間點年(一) 
setmonth(int); --> 設定時間點年(二) 
setday(int);   --> 設定日(一) 
setyear2(int); --> 設定日(二)   
setmonth2(int);--> 設定月(一) 
setday2(int);  --> 設定月(二)  
getData();     --> 取得第一個日期 
LeapYear(int); --> 是否閏年的判斷 
print_week();  --> 印出星期 
cal_day();     --> 判斷輸入的日期是否有誤 


ratey12 at 無名小站 at 08:50 PM post | Reply(0) | Trackback(0) | prosecute
March 29, 2011

時間倒數-先輸入(時 分 秒)


/*許巧慧--B09902147--資工一丙**
*------------第2版------------*
*類別和物件:----------時間倒數*/
#include<iostream>
#include<windows.h>
#include<time.h>
using namespace std;
/*元素:秒second 分minute 時hour*/
class Time
{
private: 
  int second;
  int minute;
  int hour;
public:
  Time(int=0,int=0,int=0); //小時分鐘秒數
  void print_time();
  void setreciprocal(int,int,int); //倒數時間 
  void sethour2(int);


ratey12 at 無名小站 at 08:22 PM post | Reply(1) | Trackback(0) | prosecute
March 29, 2011

一般時間運作-先輸入(時 分 秒)


/*許巧慧--B09902147--資工一丙**
*------------第1版------------*
*類別和物件:----------一般時間*/
#include<iostream>
#include <windows.h>
#include <time.h>
using namespace std;
/*元素:秒second 分minute 時hour*/
class Time
{
private: 
  int second;
  int minute;
  int hour;
public:
  Time(int=0,int=0,int=0);
  void setTime(int,int,int);
  void sethour(int);
  void setminute(int);


ratey12 at 無名小站 at 08:19 PM post | Reply(0) | Trackback(0) | prosecute
March 29, 2011

撲克牌


/****資工一丙  許巧慧  b09902147****/
/**************第三版*************** 
*題目:發牌5張後判斷下列的牌種       *
1.    One pair 一對                   *
2.    Two pair 兩對                   *
3.    Three of kind 三條              * 
4.    Stright 順子                    *
5.    Full house 葫蘆                 *
6.    Four of a kind 四條、四梅、鐵支 *
7.    Stright Flush 同花順            *
************************************/
#include<iostream>
  
using namespace std;
/*牌的主鍵:color花色,point數字
 print_card():印出牌的花色和數字,set_a_card():設定牌的花色和數字*/
class Card
{
private:


ratey12 at 無名小站 at 08:17 PM post | Reply(1) | Trackback(0) | prosecute
March 22, 2011

撲克牌發牌+判斷牌種 c++

發牌的程式碼:(未完成,只有發牌)

#include  
using namespace std;
/*牌的主鍵:color花色,point數字
print_card():印出牌的花色和數字,set_a_card():設定牌的花色和數字*/
class Card
{
private:
 char color;     
 int point;
public:
  Card();
  void print_card();
  void set_a_card(char, int);
};      
/*設定初始值:花色是梅花'S',數字為0*/
Card::Card()
{
  color='S';


ratey12 at 無名小站 at 11:15 PM post | Reply(4) | Trackback(0) | prosecute
February 26, 2011

程式設計實作與應用

題目:停車費的計算
1.每小時為單位
2.超過時間五分鐘,已半小時為單位計算
3.平日星期一到星期五每單位收費20元
4.假日為每單位收費的兩倍


ratey12 at 無名小站 at 03:13 PM post | Reply(0) | Trackback(0) | prosecute
December 31, 2010

c語言程式 加法(迴圈的計算)

1加到10
#include <stdio.h>
#include <stdlib.h>


int main(void)
{
    int i, sum=0;
    for(i=1;i<=10;i++)
        sum+=i;
    printf("1+2+3+.....+10=%d\n",sum);
    
    system("pause");
    return 0;
}
單數的加法(1~50)


#include <stdio.h>
#include <stdlib.h>


ratey12 at 無名小站 at 01:55 AM post | Reply(0) | Trackback(0) | prosecute
December 31, 2010

c語言程式 計算水費

題目:
一度要4元
0~40度        160元
40~100度     前40度以一樣的價錢計算,後面以一度1.2倍的價錢計算
100~200度   前40度以一樣的價錢計算,後面以一度1.5倍的價錢計算
200~300度   前40度以一樣的價錢計算,後面以一度1.8倍的價錢計算
300度以上    前40度以一樣的價錢計算,後面以一度3倍的價錢計算 

  

#include <stdio.h>
#include <stdlib.h>

int main(void)

{
     float a,f;
     
     printf("請輸入度數:");
     scanf("%f",&a);
     


ratey12 at 無名小站 at 01:36 AM post | Reply(0) | Trackback(0) | prosecute
December 31, 2010

c語言程式 溫度等級


#include
#include

int main(void)

{
     int a;
     
     printf("請輸入溫度:"); 
     scanf("%d",&a);
     
     if(a>=40)
     {
              printf(" 熟了 \n",a);
     }
     
     if((a>=30) && (a<40)) 
     {
              printf(" 很熱 \n",a);


ratey12 at 無名小站 at 01:26 AM post | Reply(0) | Trackback(0) | prosecute
December 31, 2010

c語言程式 四數的排列


#include
#include

int main(void)

{
    int a,b,c,d;
    void sort(int,int,int,int);
   
    printf("Input a=");
    scanf("%d",&a);
    printf("Input b=");
    scanf("%d",&b);    
    printf("Input c=");
    scanf("%d",&c); 
    printf("Input d=");
    scanf("%d",&d); 
    
    sort(a,b,c,d);


ratey12 at 無名小站 at 01:25 AM post | Reply(2) | Trackback(0) | prosecute
December 31, 2010

c語言程式 數字等級


#include
#include

int main(void)

{
     float a;
     
     scanf("%f",&a);
     
     if(a>=90)
     {
              printf(" 極優 \n",a);
     }
     
     else if(a>=80)
     {
              printf(" 優 \n",a);
     }     


ratey12 at 無名小站 at 01:24 AM post | Reply(0) | Trackback(0) | prosecute
December 31, 2010

c語言程式 比大小


二數從大到小
 

#include
#include

int main(void)

{
    int a,b;
    void sort(int,int);
    
    scanf("%d",&a);
    scanf("%d",&b);
    
    sort(a,b);
    
    system("pause");
    return 0 ;


ratey12 at 無名小站 at 01:22 AM post | Reply(0) | Trackback(0) | prosecute
December 31, 2010

c語言程式 檢查身分證字號


#include
#include
int main (void)
{
    int a,b,c,d,e,f,g,h,i,j,x,y; 
    printf("輸入身分證英文字所代表的第一個數字=",a);
    scanf("%d",&a);
    printf("輸入身分證英文字所代表的第二個數字=",b);
    scanf("%d",&b);
    printf("輸入身分證數字第一碼=",c);
    scanf("%d",&c);
    printf("輸入身分證數字第二碼=",d);
    scanf("%d",&d);
    printf("輸入身分證數字第三碼=",e);
    scanf("%d",&e);
    printf("輸入身分證數字第四碼=",f);
    scanf("%d",&f);
    printf("輸入身分證數字第五碼=",g);
    scanf("%d",&g);


ratey12 at 無名小站 at 12:57 AM post | Reply(0) | Trackback(0) | prosecute
December 31, 2010

c語言程式 算面積

算面積(公尺轉尺)


#include
#include
int main (void)
{
    float a,a1,b,b1,m,e;
    
    printf("請輸入長度:",m);
    scanf("%f",&a);
    a1=a*3.3;
    printf("請輸入寬度:",m);
    scanf("%f",&b);
    b1=b*3.3;
    e=a1*b1/36.0;
    printf("坪數:%f",e);
    scanf("%f",&e);
    
    system("pause");


ratey12 at 無名小站 at 12:56 AM post | Reply(1) | Trackback(0) | prosecute
December 31, 2010

c語言程式 國英數成績平均的計算


#include
#include
int main (void)
{
    float f,a,b,c;
    printf("請輸入國文成績:");
    scanf("%f",&a);
    printf("請輸入英文成績:");
    scanf("%f",&b);
    printf("請輸入數學成績:");
    scanf("%f",&c);
    f=(a+b+c)/3.0; 
    printf("平均分數=%f",f);
    scanf("%f",&f);
    
    system("pause");
    return 0;
}


ratey12 at 無名小站 at 12:49 AM post | Reply(1) | Trackback(0) | prosecute
December 31, 2010

c程式語言 停車場費率

題目是 停車的時間若小於等於5分鐘,就不算時間
           停車的時間若大於5分鐘然後又小於等於60分鐘,就算兩個半小時
           停車的時間若大於60分鐘,前兩個半小時之後,用百分之30來計算,但如果過了一小時又過小於等於五分鐘,這五分鐘不算錢
           
           星期一~星期五 一個半小時算15元
           星期六~星期日 是平日的兩倍            

 

#include
#include

int main(void)

{
 int t,t1,t2,h,h1,h2,w,f;

 printf("請輸入停車時間:");
 scanf("%d",&t);


ratey12 at 無名小站 at 12:47 AM post | Reply(0) | Trackback(0) | prosecute

unlog_NVPO 0