switch文を使って実際の問題を解決することを学ぶ

1347 ワード

 12   3:
    :    switch        
    :      。
*         (             ,             )
*             
* Copyright (c) 2011,            
* All rights reserved.
*     :                             
*       :                                
*     :     2011         11         11    
*      :    1.0     
*              
*     :     
*     :             ,     (     )。       ,        。  =  ×   ×  (  : ,     360  )。    switch  ,         ,          。    2011 7 7         :    0.50%,3    3.10%,6   3.30%,   3.50%,   4.40%,   5.00%,   5.50%。
*     :       
*     :……
*     :……
*          (        )
#include   
using namespace std;
void huoqi( );
void siqi( );
int main( )
{   int t;
 cout<>t;
 switch (t)
 {
  case 1:huoqi ( );break;
  case 2:siqi  ( );break;
 }
 return 0;
}
 void huoqi( )
 {
         double lixi , time , benjin;
   cout<>benjin;
   cout<>time;
   lixi=benjin*0.005*time/365;
   cout<>benjin;
   cout<>time;
   i=time/3;
   switch (i)
   {
     case 1 : lilv=0.0310,time=0.25;break;
     case 2 : lilv=0.0330,time=0.50;break;
     case 4 : lilv=0.0350,time=1.00;break;
     case 8 : lilv=0.0440,time=2.00;break;
           case 12: lilv=0.0500,time=3.00;break;
           case 20: lilv=0.0550,time=5.00;break;
   }
   lixi=benjin*lilv*time;
   cout<