int main() { Sorcerer robert("Robert", "the Magnificent"); Victim jim("Jimmy"); Peon joe("Joe"); std::cout << robert << jim << joe; robert.polymorph(jim); robert.polymorph(joe); std::cout << std::endl << "+++++++++Extra TEXTS+++++++++" << std::endl << std::endl; Victim matt("Matt"); Peon ben("Ben"); Victim *Super_Jim = new Peon("Super_Jim");// std::cout << robert << matt << ben;// std::cout << *Super_Jim;// std::cout << std::endl << "+++++++++ matt = ben +++++++++" << std::endl << std::endl; matt = ben;// std::cout << robert << matt << ben;// robert.polymorph(matt);// robert.polymorph(ben);// robert.polymorph(*Super_Jim);// delete Super_Jim; return 0; }
int main() { { Sorcerer robert("Robert", "the Magnificient"); Victim jim("Jimmy"); Peon joe("Joe"); std::cout << robert << jim << joe; robert.polymorph(jim); robert.polymorph(joe); } { Victim joe("Joe"); Victim sarah = joe; Victim bob(sarah); std::cout << joe << sarah << bob; joe.getPolymorphed(); sarah.getPolymorphed(); bob.getPolymorphed(); Peon pepe("Pepe"); Peon carl = pepe; Peon martin(carl); Victim bobby = martin; Victim sar(carl); std::cout << pepe << carl << martin << bobby << sar; } return 0; }
void sujet(void) { Sorcerer robert("Robert", "the Magnificent"); Victim jim("Jimmy'"); Peon joe("Joe"); std::cout << robert << jim << joe; robert.polymorph(jim); robert.polymorph(joe); }
int main() { Sorcerer robert("Robert", "the Magnificent"); Victim jim("Jimmy"); Peon joe("Joe"); std::cout << robert << jim << joe; robert.polymorph(jim); robert.polymorph(joe); return (0); }
int main() { try { Bureaucrat jim("Jim", 160); } catch (std::exception & e) { std::cout << e.what() << std::endl; } try { Bureaucrat jim("Jim", 0); } catch (std::exception & e) { std::cout << e.what() << std::endl; } Bureaucrat paul("Paul", 1); Bureaucrat annie("Annie", 150); std::cout << paul; std::cout << annie; try { paul.incrementGrade(); } catch (std::exception &e) { std::cout << e.what() << std::endl; } try { annie.decrementGrade(); } catch (std::exception &e) { std::cout << e.what() << std::endl; } std::cout << paul; std::cout << annie; paul.decrementGrade(); annie.incrementGrade(); std::cout << paul; std::cout << annie; return 0; }
int main(int, const char * []) { IloEnv env; try { IloInt i,j; IloModel model(env); IloNumExpr cost(env); IloIntervalVarArray allTasks(env); IloIntervalVarArray joeTasks(env); IloIntervalVarArray jimTasks(env); IloIntArray joeLocations(env); IloIntArray jimLocations(env); MakeHouse(model, cost, allTasks, joeTasks, jimTasks, joeLocations, jimLocations, 0, 0, 120, 100.0); MakeHouse(model, cost, allTasks, joeTasks, jimTasks, joeLocations, jimLocations, 1, 0, 212, 100.0); MakeHouse(model, cost, allTasks, joeTasks, jimTasks, joeLocations, jimLocations, 2, 151, 304, 100.0); MakeHouse(model, cost, allTasks, joeTasks, jimTasks, joeLocations, jimLocations, 3, 59, 181, 200.0); MakeHouse(model, cost, allTasks, joeTasks, jimTasks, joeLocations, jimLocations, 4, 243, 425, 100.0); IloTransitionDistance tt(env, 5); for (i=0; i<5; ++i) for (j=0; j<5; ++j) tt.setValue(i, j, IloAbs(i-j)); IloIntervalSequenceVar joe(env, joeTasks, joeLocations, "Joe"); IloIntervalSequenceVar jim(env, jimTasks, jimLocations, "Jim"); model.add(IloNoOverlap(env, joe, tt)); model.add(IloNoOverlap(env, jim, tt)); model.add(IloMinimize(env, cost)); /* EXTRACTING THE MODEL AND SOLVING. */ IloCP cp(model); if (cp.solve()) { cp.out() << "Solution with objective " << cp.getObjValue() << ":" << std::endl; for (i=0; i<allTasks.getSize(); ++i) { cp.out() << cp.domain(allTasks[i]) << std::endl; } } else { cp.out() << "No solution found. " << std::endl; } } catch (IloException& ex) { env.out() << "Error: " << ex << std::endl; } env.end(); return 0; }
int main(int argc, char* argv[]){ request_records(0); //Get Caught Up std::thread jim (update); //jim constantly checks for updates. Poor jim. std::thread user_thread(user); //start update thread //start user thread jim.join(); user_thread.join(); }
int main(void) { { Weapon club = Weapon("crude spiked club"); HumanA bob("Bob", club); bob.attack(); club.setType("some other type of club"); bob.attack(); } { Weapon club = Weapon("crude spiked club"); HumanB jim("Jim"); jim.setWeapon(club); jim.attack(); club.setType("some other type of club"); jim.attack(); } }
int main() { Sorcerer robert("Robert", "the Magnificent"); Victim jim("Jimmy"); Peon joe("Joe"); std::cout << robert << jim << joe; robert.polymorph(jim); robert.polymorph(joe); std::cout << std::endl; Perifalk henri("Henri"); std::cout << henri; robert.polymorph(henri); std::cout << std::endl; Peon copy(joe); Peon copy2("Franck"); copy2 = copy; std::cout << std::endl; return 0; }
int main(void) { Bureaucrat bob("bob", 45); Bureaucrat jim("jim", 150); Bureaucrat zac("zac", 2); Form A4("A4", 45, 45); Form A5("A5", 150, 21); ShrubberyCreationForm Creation("home"); PresidentialPardonForm Pardon("Amedy Coulibaly"); RobotomyRequestForm Robot("Zaz"); try { Form a("fifi", 0, 2); } catch (std::exception const& e) { std::cout << "Form a: " << e.what() << std::endl; } try { Form b("fifi", 42, 151); } catch (std::exception const& e) { std::cout << "Form b: " << e.what() << std::endl; } std::cout << A4 << std::endl << A5 << std::endl << std::endl; std::cout << bob << std::endl << jim << std::endl << std::endl; try { A4.beSigned(jim); } catch (std::exception const& e) { std::cout << "Form A4: " << e.what() << std::endl; } std::cout << A4 << std::endl << std::endl; try { A4.beSigned(bob); } catch (std::exception const& e) { std::cout << "Form A4: " << e.what() << std::endl; } std::cout << A4 << std::endl << std::endl; bob.signForm(A4); bob.signForm(A5); jim.signForm(A4); jim.executeForm(Creation); bob.executeForm(Creation); zac.signForm(Pardon); zac.executeForm(Pardon); jim.executeForm(Pardon); zac.signForm(Robot); zac.executeForm(Robot); zac.executeForm(Robot); zac.executeForm(Robot); zac.executeForm(Robot); jim.executeForm(Robot); }