Rev 347 | Blame | Last modification | View Log | RSS feed
/******************************************************************************** main.cc** Implementation of the main function.** Copyright 2006, Ira W. Snyder (devel@irasnyder.com)******************************************************************************/#include <iostream>#include <gtkmm/main.h>#include "elevator_window.h"int main (int argc, char *argv[]){int numFloors = -1;int numElevators = -1;std::cout << "Enter the number of floors [2-10]: ";std::cin >> numFloors;std::cout << "Enter the number of elevators [1-5]: ";std::cin >> numElevators;if (numFloors < 2 || numFloors > 10){std::cerr << "Invalid number of floors" << std::endl;return 1;}if (numElevators < 1 || numElevators > 5){std::cerr << "Invalid number of elevators" << std::endl;return 2;}// Set up the controllerController c(numFloors, numElevators);// Start GTKGtk::Main kit (argc, argv);// Create the windowElevator_Window window (numFloors, numElevators);// Set associationswindow.set_controller (&c);c.set_gui (&window);// Start the backendc.start_all_elevators ();// Start the GUIGtk::Main::run (window);return 0;}