Оператор копьё и сотоварищи

« картинки и свежие анекдоты | чат

Оператор копьё и сотоварищи

Впервые я увидел "оператор копьё" здесь (The "goes toward" operator). Он мне сразу приглянулся и мне захотелось придумать побольше таких операторов. В результате появился такой код:
// local
#include "warriors.hpp"

// stl
#include <iostream>

int main()
{
  Spearman s("Elmund", 15);
  Lancer l("Marius", 12);
  Hammerer h("Bork", 20);
  Macer m("Rigolus", 18);
  Merman mm("Novarro", 19);
  Thief t("Delon", 12);
  Gunner g("mr. Smith", 22);
  Bomber b("Akhmed", 19);

  std::cout << "-- The battle has been started --" << std::endl;

  s --> l;
  m --* h;
  h --()- s;
  l ----> g;
  mm ---E- m;
  t +- mm;
  g ,-- h;
  b ( )--* t;

  std::cout << "-- The battle has been finished --" << std::endl;

  return 0;
}

Вывод:
Elmund is entering the battle
Marius is entering the battle
Bork is entering the battle
Rigolus is entering the battle
Novarro is entering the battle
Delon is entering the battle
mr. Smith is entering the battle
Akhmed is entering the battle
-- The battle has been started --
Elmund is throwing spear to Marius
Marius has recieved 10 damage
Rigolus is beating Bork by mace
Bork has recieved 8 damage
Bork is crushing hammer on Elmund
Elmund has recieved 15 damage
Elmund is dead
Marius is piercing mr. Smith by lance
mr. Smith has recieved 20 damage
Novarro is striking Rigolus with trident
Rigolus has recieved 16 damage
Delon is backstabing Novarro by dagger
Novarro has recieved 16 damage
mr. Smith is shooting Bork from handgun at
Bork has recieved 30 damage
Bork is dead
Akhmed is blasting Delon
Delon has recieved 50 damage
Delon is dead
-- The battle has been finished --
Akhmed is leaving the battle with 19 health
mr. Smith is leaving the battle with 2 health
Delon's body is staying on the battleground
Novarro is leaving the battle with 3 health
Rigolus is leaving the battle with 2 health
Bork's body is staying on the battleground
Marius is leaving the battle with 2 health
Elmund's body is staying on the battleground

P.S. Компилировал на GCC-4.1.2, за другие компиляторы не ручаюсь.
P.P.S. Пользуясь случаем, прошу прощения за мой английский.

Комментарий:

Ваше имя:

Ещё интересное на этом сайте:

Кошки блокадного Ленинграда
За что вам стыдно?
Мы рады вам всегда!
И зачем же он ему помог...
Гигантская покемон-коллекция
#2079: Замкнутая экосистема
#2078: Пендальф... Упс!
Анекдоты и картинки #2535538
Анекдоты и картинки #2535537
Сексуальный гардероб для мужчины
Жаба
Анекдоты ПДА
Канобувости, 24-й выпуск
Рисованные знаменитости
Как ебутся кони
Гы
Однако.... [порно, 3д]
Анекдот
Подборка Фэйлов (35 фото)
Ёкономия. Ётить ее мать!
« все анекдоты и картинки
Рейтинг@Mail.ru