SebastianLawe

Untitled

Jan 28th, 2015
267
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.09 KB | None | 0 0
  1. // C5E1HouseBuilder.cpp : Defines the entry point for the console application.
  2. //Sebastian Lawe 12/5/2013 - Chapter 5 Exercise 1 - Builds a house.
  3. #include "stdafx.h"
  4. #include <iostream>
  5. using namespace std;
  6. //Declare enumerable.
  7. enum HouseSection{Roof, Base, Walk};
  8. //Declare function.
  9. void HouseBuilder(HouseSection section);
  10. int _tmain(int argc, _TCHAR* argv[])
  11. {
  12.     //Call "HouseBuilder" to create roof.
  13.     HouseBuilder(Roof);
  14.     //Call "HouseBuilder" to create base.
  15.     HouseBuilder(Base);
  16.     //Call "HouseBuilder" to create walk.
  17.     HouseBuilder(Walk);
  18.     //Keep program from closing.
  19.     std::getchar();
  20.     return 0;
  21. }
  22. void HouseBuilder(HouseSection section){
  23.     //Use switch statement to check what section must be built.
  24.     switch(section){
  25.     case Roof:
  26.         //In the scenerio its a roof, print roof.
  27.         cout<<"  /\\  \n";
  28.         cout<<" /  \\ \n";
  29.         cout<<"/____\\\n";
  30.         break;
  31.     case Base:
  32.         //In the scenerio its a base, print base.
  33.         cout<<"|    |\n";
  34.         cout<<"|____|\n";
  35.         break;
  36.     case Walk:
  37.         //In the scenerio its a walk, print walk.
  38.         cout<<"  **\n";
  39.         cout<<"  *************\n";
  40.         break;
  41.     }
  42. }
Advertisement
Add Comment
Please, Sign In to add comment