做出决策之if控制结构(3)

//嵌套的if-else控制结构
#include<iostream>
usingnamespace std;
int main()
{
       
int day;
       
double time;

        cout
<<"Type the day and time of interest"<<endl;
        cin
>>day>>time;

       
if(day<=5)
       
{
               
if(time<=9.00)
                        cout
<<"Drive piles"<<endl;
               
else
                        cout
<<"Construct formwork"<<endl;
       
}
       
else
       
{
               
if(time<=8.00)
                        cout
<<"Maintain equipment"<<endl;
               
else
                        cout
<<"Point concrete"<<endl;
       
}//if-else控制结构里面包括有if-else控制结构。
       
return0;
}
/*嵌套的if-else控制结构:
  if(outer)
  {...
  if(inner_1)
  {...}
  else
  {...}

  if(inner_2)
  {...}
  else
  {...}
  }
  else
  {...}
  */
posted @ 2012-06-22 21:03  蚂蚁踩死了大象  阅读(149)  评论(0)    收藏  举报