Advertisement
Guest User

max_storey = 100000

a guest
Nov 2nd, 2013
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.59 KB | None | 0 0
  1. static int siteIndex(const QString& site)
  2. {
  3.     static const int max_storey = 100000;
  4.  
  5.     if (site == "Обвязка") return 0;
  6.     if (site.startsWith("Перекрытие ")) {
  7.         bool ok;
  8.         int n = site.mid(11).toInt(&ok);
  9.         if (ok && n <= max_storey) return n * 2 - 1;
  10.     }
  11.     if (site.endsWith(" этаж")) {
  12.         bool ok;
  13.         int n = site.left(site.size() - 5).toInt(&ok);
  14.         if (ok && n <= max_storey) return n * 2;
  15.     }
  16.     if (site == "Чердак") return INT_MAX - 2;
  17.     if (site == "Кровля") return INT_MAX - 1;
  18.     return INT_MAX;
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement