< previous page page_a50 next page >

Page A50
3e26ecb1b6ac508ae10a0e39d2fb98b2.gif
cin.ignore(100, \n);
cin.get(chr3);
cin.ignore(100, \n);
8. #include <iostream.h>
   #include <fstream.h>

   int main()
   {
       int      val1;
       int      val2;
       int      val3;
       int      val4;
       ifstream dataIn;
       ofstream resultsOut;

       dataIn.open(myinput.dat);
       resultsOut.open(myoutput.dat);
       dataIn >> val1 >> val2 >> val3 >> val4;
       resultsOut << val1 << val2 << val3 << val4 << endl;
       return 0;
}
9. Note that the problem statement said nothing about getting into the car, adjusting seatbelts, checking the mirror, or driving away. Presumably those tasks, along with starting the car, are subtasks of a larger design such as Go to the store. Here we are concerned only with starting the car itself.
Main Module
3e26ecb1b6ac508ae10a0e39d2fb98b2.gif
Ensure car won't roll.
3e26ecb1b6ac508ae10a0e39d2fb98b2.gif
Disengage gears.
3e26ecb1b6ac508ae10a0e39d2fb98b2.gif
Attempt ignition.
Ensure car won't roll
3e26ecb1b6ac508ae10a0e39d2fb98b2.gif
Engage parking brake.
3e26ecb1b6ac508ae10a0e39d2fb98b2.gif
Turn wheels into curb.
Disengage gears
3e26ecb1b6ac508ae10a0e39d2fb98b2.gif
Push in clutch with left foot.
3e26ecb1b6ac508ae10a0e39d2fb98b2.gif
Move gearshift to neutral.
3e26ecb1b6ac508ae10a0e39d2fb98b2.gif
Release clutch.
Attempt ignition
3e26ecb1b6ac508ae10a0e39d2fb98b2.gif
Insert key into ignition slot.
3e26ecb1b6ac508ae10a0e39d2fb98b2.gif
Turn key to ON position.
3e26ecb1b6ac508ae10a0e39d2fb98b2.gif
Pump accelerator once.
3e26ecb1b6ac508ae10a0e39d2fb98b2.gif
Turn key to START position.
3e26ecb1b6ac508ae10a0e39d2fb98b2.gif
Release after engine catches or 5 seconds, whichever comes first.

 
< previous page page_a50 next page >