C++誕生日で星座を判断

8318 ワード

//誕生日を入力して星座を判断する
#include 
#include 
using namespace std;

int main()
{
    //        
    /**     */
    int bir_month;
    /**     */
    int bir_day;
    /**        */
    string constell_name[12][2] = {
        {"   ","   "},//  
        {"   ","   "},//  
        {"   ","   "},//  
        {"   ","   "},//  
        {"   ","   "},//  
        {"   ","   "},//  
        {"   ","   "},//  
        {"   ","   "},//  
        {"   ","   "},//  
        {"   ","   "},//  
        {"   ","   "},//   
        {"   ","   "},//   
    };
    /**          */
    int constell_value[] = {20,19,21,20,21,22,23,23,23,24,23,22};
    cout << "       ( MM DD ): " ;
    cin >> bir_month >> bir_day;
    //       constell_name[][]  ,          1              
    //                           ,
    //  6 6 ,       constell_name[6-1][],       constell_value[6-1]=22,  6/22=0,        constell_name[6-1][0],    
    cout << constell_name[bir_month - 1][bir_day / constell_value[bir_month - 1]];

    return 0;
}

//プログラム出力
       ( MM DD ): 11 16
   
Process returned 0 (0x0)   execution time : 11.932 s
Press any key to continue.