// page89.cpp : 定义控制台应用程序的入口点。
//C++ 面向对象程序设计
//演示花括号在 if-else语句的重要作用
#include "stdafx.h"
#include <iostream>
using namespace std ;
int main()
{
double fuel_gauge_reading;
cout << " Enter fuel gauge reading : ";
cin >> fuel_gauge_reading;
cout << " Frist with braces :\n ";
if ( fuel_gauge_reading <0.75)
{
if(fuel_gauge_reading <0.25 )
cout << " Fuel very low .Caution:\n ";
}
else
{
cout << " Fuel over 3/4 . Don`t stop now!\n" ;
}
cout << " Now without braces :\n";
if ( fuel_gauge_reading < 0.75)
if(fuel_gauge_reading < 0.25)
cout << " Fuel very low .Caution !\n";
else
cout << " Fuel ouer 3/4 . Don~t stop now !\n";
cin >>fuel_gauge_reading;
return 0;
}