daily pastebin goal
67%
SHARE
TWEET

Untitled

a guest Oct 17th, 2018 65 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include "multi.h"
  2.  
  3. Event::Event(std::string area,std::string typeOfProblem,float length){
  4.     m_area=area;             /// oblast kde nastala bezpecnosti udalost (kod, napr. Q237)
  5.     m_typeOfProblem=typeOfProblem;    /// typ problemu (pohyb, zvuk, ...)
  6.     m_length=length;    /// delka udalosti (23.5 s)
  7.  
  8. }
  9.  
  10. /// nahraje ulozene udalosti ze skouboru,
  11. /// pokud je zadano spatne jmeno, vyhodi vyjimku - 9 bodu
  12. void BezpecnostniIS::loadImageFromTextFile(std::string fileName) throw (std::domain_error){
  13. std::ifstream in (fileName.c_str());
  14.  
  15.     if (in.is_open()){
  16.  
  17.         long razitko;
  18.         std::string oblast;
  19.         std::string problem;
  20.         float delka;
  21.  
  22.         while ((in>>razitko)and(in>>oblast)and(in>>problem)and(in>>delka)){
  23.             m_events.insert(std::pair<long,Event>(razitko,Event(oblast,problem,delka)));
  24.         }
  25.  
  26.         }else{
  27.             throw std::domain_error("neotevre se");
  28.         }
  29. }
  30.  
  31. void BezpecnostniIS::vypis(){
  32.     for (std::multimap <long,Event>::iterator it= m_events.begin();it!=m_events.end();it++){
  33.     std::cout<< it->first <<" - ";
  34.   ///jak vypsat tu hodnotu co je v second??
  35.     std::cout<< it->second.m_area<<it->second.m_typeOfProblem<<it->second.m_length<<std::endl;
  36.     }
  37. };
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top